避免将所有布局合并为一个页面?

时间:2015-08-19 19:12:57

标签: javascript angularjs twitter-bootstrap meteor

我正试图将我在html上的bootstrap文件转移到使用meteor实现。我希望一切都在单独的页面上,但我的程序在一个页面上显示我的所有页面,即使我通过angular-ui-router路由文件。这是我放在root / client文件夹中的routes.js文件:

angular.module("project").config(['$urlRouterProvider', '$stateProvider', '$locationProvider',
  function($urlRouterProvider, $stateProvider, $locationProvider){

    $locationProvider.html5Mode(true);

    $stateProvider
      .state('aboutus', {
      url: '/aboutus',
      templateUrl: 'client/views/about.html',
      })
      .state('contactus',{
          url: '/contactus', 
          templateUrl: 'client/views/contact.html',
      })
      .state('home', {
          url: '/home', 
          templateUrl: 'client/views/index.html',
      })
      .state('services', {
        url: '/services',
        templateUrl: 'client/views/services.html',
      })

    $urlRouterProvider.otherwise("/home");
  }]);

如果你想看整个项目,这里是: https://github.com/Aggr0vatE/project

1 个答案:

答案 0 :(得分:0)

来自文档(http://docs.meteor.com/#/full/structuringyourapp):

  

Meteor扫描目录中的所有HTML文件,包含三个顶级元素:<head><body><template>。头部和主体部分分别连接成一个头部和主体,在初始页面加载时传送给客户端。

您需要构建html文件以利用Meteor模板。事实上,您拥有headbody标记中的所有内容,这就是为什么它会被合并到一个页面中的原因。我建议阅读以上链接中的一些文档。