2015-09-23 122 views
1

我觉得我很亲密,但我挂断了为什么这个设置不适合我。 https://github.com/jaruesink/first_meteor角流星与CoffeeScript/Jade

非常感谢任何能够帮助解决这个问题的人,我只是想学习一些新的项目并且获得乐趣。

脚本/ _main.coffee

@App = angular.module('App', [ 
'angular-meteor' 
'ngMaterial' 
'ui.router' 
]) 

@App.config [ 
    '$interpolateProvider' 
    ($interpolateProvider) -> 
     $interpolateProvider 
      .startSymbol '[[' 
      .endSymbol ']]' 
] 

脚本/ router.coffee

@App.config [ 
    '$stateProvider', '$urlRouterProvider', '$locationProvider' 
    ($stateProvider, $urlRouterProvider, $locationProvider) -> 
     $locationProvider.html5Mode true 
     $urlRouterProvider.otherwise '/home' 
     $stateProvider.state('home' 
      url: '/home' 
      templateUrl: UiRouter.template 'home' 
     ) 
] 

index.jade

head 
    title App 
    base(href="/") 
body(ng-app="App") 
    div.container 
     h1 If 2 + 5 = [[2+5]], then I'm working :-) 
     p but why isn't the router below showing up? 
     div(ui-view) 

的意见/家庭/ home.jade

template(name='home') 
section#home 
    div.container 
     h1 hello world, 1 + 2 = [[1+2]] 

但这里是发生了什么(高亮显示的UI视图再次重复所有的脚本的头部代码太)

I get duplicate code where one works and the other doesn't

enter image description here

+0

也为有兴趣的人这些都是到目前为止,我已经安装了软件包: 角:角料0.10.1 * | angularui:angular-ui-router 0.2.15 | autopublish 1.0.3 * | bootstrap 1.0.1 | 不安全1.0.3 * | less 1.0.14 * | meteor-platform 1.2.2 * | meteorhacks:kadira 2.23.0 * | mquandalle:玉0.4.3 * | ndxbxrme:ng-coffeescript 1.2.2 | urigo:angular 0.9.3 * | urigo:angular-ui-router 0.7.0 – jaruesink

+0

这里没有论据,但你为什么要用Angular与Meteor?我已经做了一段时间Angular,并转向流星:它拥有所有你想要和需要的,更多,没有开销。只要去流星,忘记角;海事组织混合2只是让你的生活无缘无故。 – MrE

+0

哈哈@MrE你可能是对的,但我仍然认为角度做一些好的流星没有的东西。我非常密切地关注角材料,并且非常喜欢它们让它构建完整的应用程序变得容易。所以这就是主要原因 – jaruesink

回答

1

在您的文件router.coffee,在templateUrl属性你只需要提及模板的名称如下图所示:

@App.config [ 
    '$stateProvider', '$urlRouterProvider', '$locationProvider' 
    ($stateProvider, $urlRouterProvider, $locationProvider) -> 
     $locationProvider.html5Mode true 
     $urlRouterProvider.otherwise '/home' 
     $stateProvider.state('home' 
      url: '/home' 
      templateUrl: 'home' 
     ) 
] 

您的应用程序将正常工作

Test of App

+0

这让我很生气哈哈,非常感谢。我觉得这很简单,但我看到的文档有另外一行。无论如何非常感谢! – jaruesink

+1

不客气,你做了很难的部分! –