Search code examples
angularjsangular-ui-routerui-sref

Module is not working


Hello fri i have created a new projects and i have created a new demo page

See to my coding in plunker i have created all code in plunker

link here

Problum is i have create a demo page check to header.html

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

if i click to about than show this error

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

can u please cehck to my code and tell me where i m wrong writing my code .

Please help me


Solution

  • The problem is the double definition of the MAIN app module: .module('azadApp', [...])

    The first in app.js:

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

    The Second in 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']);
    
    
    })();
    

    And in fact, the second definition is killing the first. So there is no 'rohit.about' at the end in the 'azadaApp'. Because the definition in the app.js is beated. Just remove the second, or set it properly...