angularjs - When changing states browser doesn't find project js files -
i trying create new state in angular using ngrouter. have index.route.js
file contains following:
(function() { 'use strict'; angular .module('testapp') .config(routeconfig); /** @nginject */ function routeconfig($stateprovider, $urlrouterprovider) { $stateprovider .state('home', { url: '/', templateurl: 'app/main/main.html', controller: 'mainctrl' }) .state('tools', { url: '/tools/:category', templateurl: 'app/tools/tools.html', controller: 'toolsctrl', controlleras: 'tsctrl' }); $urlrouterprovider.otherwise('/'); } })();
then, have created tools.html
, tools.controller.html
.
tools.html
:
hello world
tools.controller.js
:
(function(){ 'use strict'; angular .module('testapp') .controller('toolsctrl', toolscontroller); /** @nginject */ function toolscontroller(){ var ctrl = this; ctrl.tools = {}; //tbd: more code. } })();
the problem whenever go example http://localhost:3000/tools/maps
, browser complains can't find of js files suppose linked project. now, link shows contains state, example instead of searching bootstrap in http://localhost:3000/app/index.route.js
searches in http://localhost:3000/tools/app/index.route.js
. why that?
i have used yeoman gulp-angular generator in order create project.
Comments
Post a Comment