【问题标题】:Angular on Meteor with CoffeeScript/Jade带有 CoffeeScript/Jade 的 Meteor 上的 Angular
【发布时间】:2015-12-21 09:59:13
【问题描述】:

我觉得我已经很接近了,但我对为什么这个设置不适合我感到困惑。 https://github.com/jaruesink/first_meteor

感谢任何可以提供帮助的人,我只是在尝试学习并享受新项目的乐趣。

脚本/_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)

views/home/home.jade

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

但这就是发生的事情(突出显示的 ui-view 再次与所有脚本重复标题代码)

【问题讨论】:

  • 对于任何感兴趣的人来说,这些是我迄今为止安装的软件包:angular:angular-material 0.10.1* | angularui:angular-ui-router 0.2.15 |自动发布 1.0.3* |引导程序 1.0.1 |不安全的 1.0.3* |小于 1.0.14* |流星平台 1.2.2* |流星黑客:kadira 2.23.0* | mquandalle:玉 0.4.3* | ndxbxrme:ng-coffeescript 1.2.2 | urigo:角度 0.9.3* | urigo:angular-ui-router 0.7.0
  • 这里没有争议,但你为什么要使用 Angular 和 Meteor?我已经使用 Angular 一段时间并切换到 Meteor:它拥有您想要和需要的一切以及更多,而且没有开销。只需去 Meteor 并忘记 Angular; IMO 将两者混合在一起只会让您的生活更加艰难。
  • 哈哈@MrE 在大多数情况下你可能是对的,但是我仍然认为 Angular 可以很好地完成某些流星没有的事情。而且我非常密切地关注 Angular 材料,并且非常喜欢他们让构建完整应用程序变得多么容易。所以这是主要原因
  • 我很想听听一些具体的例子,说明 Angular 在哪些方面做得很好,而 Meteor 没有。

标签: angularjs meteor coffeescript meteor-blaze angular-meteor


【解决方案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'
        )
]

您的应用程序可以正常工作

【讨论】:

  • 这让我很生气哈哈,非常感谢。我认为这很简单,但我看到的文档有另一行。无论如何,非常感谢!!!
猜你喜欢
  • 1970-01-01
  • 2013-08-05
  • 2014-03-01
  • 1970-01-01
  • 2016-01-08
  • 1970-01-01
  • 2013-08-13
  • 2015-10-14
  • 2016-01-29
相关资源
最近更新 更多