Angularjs-ui-router: How to activate default views on app start up? -
I currently have 2 states in my app. Each app has multiple views. I want the state to activate the app when it starts Ho. Right now, when the app starts, I only get the link. Then I have to click any link to activate any state. How can I rule by default opened?
conflicts of states HTML First of all, your URLs must be outside the declaration object. How will your profile status look like: Secondly, you need to make sure that you have HTML5 pushstate enabled if you want routing to take an active status on "/" Otherwise your 'root' will be "/ # /" Here are some code in which you can call a push-status.js file; When you stumble on errors with client-side routing, it is very useful that I get my issues raised from PushState idesparencies (hence it is very good to toggle and close it). Is the benefit when debugging) Hope you have a good luck :)
var app = angular Modules ('dategenie', ['ui .router', 'ui.bootstrap', 'geographic location', 'ngidale', 'infinite scroll']); App.config (['$ stateProvider', '$ urlRouterProvider', function ($ stateProvider, $ urlRouterProvider) {// for any mismatched url, redirect on / urlRouterProvider profile. Otherwise ('/'); // now set Up states $ stateProvider.state ('profile', {views: {mainModule: {url: '/ profile', templateUrl: 'partials / profile.html', Controller: 'ProfileCtrl'}, rightPane module: {templateUrl: Partials / location.html ', Controller:' LocationCtrl '}}}) .state (' profiles ', {views: {main module: {url:' / ', template url:' partial / home 'html', controller: HomeCatal '}, Chat Module: {templateUrl:' partials / chat.html ', Controller:' ChatCtrl '}}}})}}); (Ui-sref = "profile") profile (ui-sref = "profile")
Logout div (ui-view = "mainModule") div (ui-view = "chatModule") div (ui-view = "rightPaneModule")
.state ('profile', {url: '/', view: {main module: {templateUrl: Partial / home 'html', controller: 'homecatalog'}, chat module: {templateUrl: 'partials / chat.html', administrator: 'ChatCtrl'}}}); Note: I'm not sure that this is still a legitimate concern, but I keep all my names in quotes. If memory works right to me, then there were some effects with the UI-router before it - it is not certain that it still applies
app.config (['$ locationProvider', function ($ location provider) {back to $ locationProvider.html5Mode (true);}]);
Comments
Post a Comment