javascript - Angular-UI-Router not working properly -
so, today added angular-ui-router webapp. however, it's showing weird behaviour. used display current page in ui-view
. page in page.
now, it's working correct, doesn't show subpages , can't seem figure out why.
main page
<!doctype html> <html lang="en" ng-app="exampleapp"> <head> <meta charset="utf-8"> <title>example app</title> </head> <body> <div> <div ui-view></div> </div> <!-- angular --> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.4/angular.js"></script> <!-- ui-router --> <script src="//angular-ui.github.io/ui-router/release/angular-ui-router.js"></script> <!-- main app file --> <script src="/js/main.js"></script> </body> </html>
main.js
var exampleapp = angular.module('exampleapp', ['ui.router']); exampleapp.config(function($stateprovider, $urlrouterprovider) { // // unmatched url, redirect /home $urlrouterprovider.otherwise("/home"); // // set states $stateprovider .state('home', { url: "/home", templateurl: "views/home.html", controller: "maincontroller" }) .state('settings', { url: "/settings", templateurl: "views/settings.html", controller: "settingscontroller" }) .state('settings.account', { url: "/account", templateurl: "views/settings.account.html", controller: "accountsettingscontroller" }); }); exampleapp.config(["$locationprovider", function($locationprovider) { $locationprovider.html5mode(true); }]);
try this
url:"settings/account",
Comments
Post a Comment