模块无法正常工作

时间:2015-03-21 17:35:38

标签: angularjs angular-ui-router ui-sref

您好!我已经创建了一个新项目,并且我创建了一个新的演示页

在plunker中查看我的编码,我在plunker中创建了所有代码

link here

Problum是我创建了一个演示页面检查header.html

<a ui-sref="rohit-about">about</a>
<a ui-sref="home">home</a>

如果我点击大约而不是显示此错误

Error: Could not resolve 'rohit-about' from state 'index'
    at Object.transitionTo (angular-ui-router.js:3074)
    at Object.go (angular-ui-router.js:3007)
    at angular-ui-router.js:4057
    at angular.js:17105
    at completeOutstandingRequest (angular.js:5073)
    at angular.js:5335

请你查看我的代码并告诉我编写代码的错误。

请帮帮我

1 个答案:

答案 0 :(得分:0)

问题是MAIN应用模块的双重定义: .module('azadApp', [...])

app.js中的第一个:

// Code goes here

angular
    .module('azadApp', [
            // here type dependency
            'rohit.about',
            'rohit.usdk'
        ]);

rohit-module/layout/js/module.js中的第二个:

// another file and/or another anonymous function
(function(){
 // using the function form of use-strict...
  'use strict';

  angular.module('azadApp', ['ui.router']);


})();

事实上,第二个定义是 kill 第一个。因此'rohit.about'的最后没有'azadaApp'。因为 app.js 中的定义是打的。只需删除第二个,或正确设置......

相关问题