Skip to content Skip to sidebar Skip to footer

Config Issues With Factories In App.js & Stateprovider

I am trying to set up a factory in my app.js of my ionic app. I have the following code that should work however my state provider is throwing me off and Im not sure where my state

Solution 1:

I don't see you have included ui.router in your app. To work with $stateProvider you should place ui.router module in your depenencies, and should include angular-ui-router.js files in your project.

angular
    .module('starter', ['ui.router']) // In your real application you should put your dependencies.. ['ng...']//.run(runFunction) // Just commenting to make it WORK HERE
    .controller('MainCtrl', MainCtrl)
    .factory('myService', myService);

ui.router is the module that provides you $stateProvider.

After this .config can go along with module like .controller and .factory. Config is also defined on you app:

angular.module('starter', ['ui.router'])
         .config(configFn) //configFn is the function you have in your .config
        .controller('MainCtrl', MainCtrl)
        .factory('myService', myService);

Post a Comment for "Config Issues With Factories In App.js & Stateprovider"