I'm trying to use the angular ui router with storm path for angular, but I keep getting an unknown provider error. My code is as follows,
var angular = require("angular");
// app.js
var app = angular.module('app', [require('angular-ui-router'), require("stormpath-sdk-angularjs")]);
app.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/');
$stateProvider
.state('home', {
url: '/',
templateUrl: 'partials/home.html'
})
.state('about', {
url: '/about',
templateUrl: 'partials/about.html'
});
})
.run(function($stormpath){
$stormpath.uiRouter({
loginState: 'login',
defaultPostLoginState: 'home'
});
});
And here is the error page,Error: $injector:unpr Unknown Provider
Stormpath are using the wrong module name in their module.exports
(I've raised a bug here ~ https://github.com/stormpath/stormpath-sdk-angularjs/issues/80).
For now, you can do this
var angular = require("angular");
require('stormpath-sdk-angularjs');
// app.js
var app = angular.module('app', [
require('angular-ui-router'), // this one is fine
'stormpath',
'stormpath.templates'
]);