Angular version 1.5.8。
以下是我的HTML页面的简化代码:
<body>
<div ng-app="identicaApp">
<div id="navbar_wrapper">
<navbar-component></navbar-component>
</div>
<div id="register_player_wrapper">
<register-player></register-player>
</div>
</div>
<script src="/static/angular/identica/identica.js"></script>
<script src="/static/angular/identica/common.js"></script>
<script src="/static/angular/identica/navbar/navbar.module.js"></script>
<script src="/static/angular/identica/navbar/navbar.component.js"></script>
<script src="/static/angular/identica/registration/register_player/register-player.module.js"></script>
<script src="/static/angular/identica/registration/register_player/register-player.component.js"></script>
</body>
Navbar正确加载,但注册器播放器组件根本没有加载,没有任何错误。这是register-player.component.js的代码:
angular.module('identicaApp.registration.player', ['identicaApp.common'])
.component('registerPlayer', {
templateUrl: '/static/angular/identica/registration/register_player/register_player.html',
controller: ['$resource', '$http', 'geolocationProvider', function RegisterPlayerController($resource, $http, geolocationProvider) {
// logic here
}]
});
我试过在
中定义控制器<div id="navbar_wrapper" ng-controller="RegisterPlayerController">
或
<navbar-component ng-controller="RegisterPlayerController"></navbar-component>
但在这种情况下,角度会下降,错误为Argument 'RegisterPlayerController' is not a function, got undefined
。我将不胜感激任何帮助。
答案 0 :(得分:0)
可能会出现模块'identicaApp.registration.player'未作为输入包含在主控制器中的情况。 对于Exmaple。 angular.module('identicaApp',['identicaApp.registration.player'])
尝试此操作并刷新页面,它应该可以正常工作。