I try to use angular-ui, and try to inject $stateProvider:
html
var bootstrapApp = angular.module('bootstrapDemoApp', ['ui.bootstrap','ui.router']);
bootstrapApp.config(function($stateProvider, $urlRouterProvider,$locationProvider) {
// For any unmatched url, redirect to /
$urlRouterProvider.otherwise("/");
// Now set up the states
$stateProvider
.state('login', {
url: "/",
controller: "loginCtrl",
templateUrl: "partials/login.html"
})
});
When using it in a controller you have to use $state
:
angular.module("appModule", ['ui.router']).controller('appController', ['$scope', '$state', function ($scope, $state) {
$scope.date = new Date();
}]);
You can only use the state provider in the config, for example:
angular.module('appModule').config(['$stateProvider', function($stateProvider){
/* do w/e with state provider */
})];