【发布时间】:2013-12-20 16:33:38
【问题描述】:
首先,感谢这个伟大的插件! (致 angularAMD 的作者)
我有一些麻烦。我已经用 ngAMD 加载了所有模块,但有两个在我的 index.html 中,因为它们是模板,我以这种方式包括在内:
<div ng-include="'views/header.html'"></div>
header.html 使用 HeaderCtrl 但我不知道在 angularAMD.bootstrap 之前如何加载...
更多代码:
header.coffee 需要应用程序
define ['app', 'bootstrap'], (app, bs) ->
'use strict'
app.controller 'HeaderCtrl', ($scope, $rootScope) ->
$scope.searchText = "";
$scope.updateSearch = ->
$rootScope.searchText = $scope.searchText;
app.coffee
define ['angular', 'angularAMD'], (angular, angularAMD) ->
'use strict'
app = angular.module 'testsApp', [
'ngRoute'
'localization'
'restangular'
]
angularAMD.bootstrap app
app
启动应用程序后,ng 尝试解决 ng-include 但 HeaderCtrl 未加载!这仅在页面上使用 CTRL+F5 时才会发生,这是加载时间的问题。我不知道如何解决这个问题。有什么提示吗?
【问题讨论】:
-
您还有问题吗?如果你这样做了,设置一个简单的 plunker,我会看看我能做些什么来提供帮助。
-
@marcoseu:谢谢。我已经解决了。我会尽快将解决方案上线。