Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I am trying to use ui-router in a new project, I followed many tutorials and documentation, but I cant't understand why my application is not launching. I am in the very start and do not have too much code. Maybe I am missing something? I am not having error in console, everything I have is a completly white page.

This is my 'app.js' with the config:

(function () {
'use strict';

angular.module('clicko', ['ui.router'])
    .config(['$stateProvider', '$logProvider', function ($stateProvider, $logProvider) {

        $logProvider.debugInfoEnabled = true;

        $stateProvider
            .state('dashboard', {
                url: '/',
                controller: 'app/dashboard/dashboardController',
                controllerAs: 'dashboard',
                templateUrl: 'app/dashboard/dashboard.html'
            });
    }
]);

})();

and this is my 'dashboardController.js':

(function () {
'use strict';

function controller($location) {
    /* jshint validthis:true */
    var vm = this;
    vm.greet = 'Heeeello World!';

    function activate() {
        alert('go');
    }

    activate();
}


////
angular
    .module('clicko')
    .controller('dashboard', controller);


controller.$inject = ['$location'];

})();

and this is my 'dashboard.html'

<h1>Dashboard</h1>

<h2>{{dashboard.greet}}</h2>

<p>Lorem ipsum dolor sit amet</p>

'index.html'

<body ng-app="clicko">

<div ui-view></div>

<!--SCRIPTS-->
<!-- ANGULARJS -->
<script src="app/assets/libs/jquery/dist/jquery.min.js"></script>
<script src="app/assets/libs/angular/angular.min.js"></script>
<script src="app/assets/libs/angular-ui-router/release/angular-ui-router.min.js"></script>

<!--APP-->
<script src="app/app.js"></script>

<!--CONTROLLLERS-->
<script src="app/dashboard/dashboardController.js"></script>

Can Somebody help me?

EDIT

Here is a plunkr: https://plnkr.co/edit/OEl278DxxB1N0xECsJwk?p=preview

share|improve this question
up vote 1 down vote accepted

One problem is:

controller: 'app/dashboard/dashboardController',

This value for the key 'controller' should be the controller name and not its path. So, change it to:

controller: 'dashboard',

EDIT:

Working plunkr here.

I changed the state to following:

.state('dashboard', {
     url: '', //changed from '/' to ''
     controller: 'dashboard',
     templateUrl: 'dashboard.html' //the path specified was wrong
})
share|improve this answer
    
Hi, thanks for your response. But, same problem yet. – rochasdv 18 hours ago
1  
Please create a plunker. – Tarun Dugar 18 hours ago
    
Tarun, Plunker added – rochasdv 18 hours ago
1  
See the edited answer. – Tarun Dugar 17 hours ago
    
Thanks so much for your help dude! – rochasdv 17 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.