javascript - Getting a # in URL from angularJS $stateProvider -
i getting strange # in middle of url example if try go localhost:8080 have angularjs app running redirected http://localhost:8080/#/home. don't understand # coming suspect has urls defining in $stateprovider.
here $stateprovider code:
//state handler //++++++++++++++++++++++++++++++++++++++++++++++++++++++++ app.config([ '$stateprovider', '$urlrouterprovider', function($stateprovider, $urlrouterprovider) { $stateprovider .state('newalarm', { url: '/newalarm', views: { '': {templateurl: '/templates/newalarmpage.html'}, 'header@newalarm':{templateurl: '/templates/header.html'}, 'newalarmform@newalarm':{templateurl: '/templates/newalarmform.html'} }, controller: 'newschedulectrl' }) //to changed .state('home', { url: '/home', views: { '': {templateurl: '/templates/homepage.html'}, 'header@home':{templateurl: '/templates/header.html'} }, controller: '' }); //end of changed $urlrouterprovider.otherwise('home'); }]);
any thoughts?
from wikipedia article on single page applications:
the page not reload @ point in process, nor control transfer page, although location hash can used provide perception , navigability of separate logical pages in application
use of hash enables angular (and other spa frameworks) route urls without reloading page.
related questions:
Comments
Post a Comment