Search code examples
angularjswebpackecmascript-6angular-ui-routerwebpack-2

Webpack + AngularJS 1.6 ui.router 1.x not loading ui-router properly


I'm using the new UI router.

"dependencies": {
    "@uirouter/angularjs": "^1.0.6"
}

using webpack to build the project. my app.js to bootstrap the app looks like,

import angular from 'angular';
//import uirouter from 'ui.router';
import uiRouter from 'angular-ui-router';

angular
.module('app', [
  uiRouter
]);

For dependencies I have tried injecting uiRouter and uirouter and (ui.router & ui-router & angular-ui-router).

Nothing seems to be working. What am I missing here?


Solution

  • Try use the right injection name ui.router. Also ensure that you using ui-router version 0.4.2 while 1.0.x has some problems with AngularJS 1.6.

    import angular from "angular"
    import "angular-ui-router"
    
    angular.module('app', ['ui.router']);
    

    Dependencies:

    "dependencies": {
        "@uirouter/angularjs": "0.4.2"
    }