angularjs - Redirect to a new template in angular js -


i new angularjs, please consider mistakes.

the scenario is, have index.html page , login.html page, index , login have different layout different header footer , all. other pages expect login share same layout index.html

now, how can navigate login.html using anuglar ui router.

myapp.config(function ($stateprovider, $urlrouterprovider) {

$stateprovider.state('home', {         url: '/',         templateurl: 'app/views/site/home.html',         controller: 'homectrl'     }).state('login', {         url: '/login',         templateurl: 'app/views/site/login.html'     }) }); 

this not work loads content of login index keeping header , footer same of index. know state supposed work way.

now, there way can call new view using ui.router.

i appreciate help. thanks

you set multiple named views (https://github.com/angular-ui/ui-router/wiki/multiple-named-views).

this allow make header , footer separate views can swap in , out. don't think there way swap out entire page, though.

<body>     <header ui-view="header"></header>     <main ui-view="content"></main>     <footer ui-view="footer"></footer> </body>  .state('login', {     views: {       'header': { ... templates and/or controllers ... },       'content': {  ... templates and/or controllers ... },       'footer': {  ... templates and/or controllers ... },     }   }) 

Comments

  1. Hotel Casino Games in Las Vegas - Boyd Gaming
    A new, upscale 피망 슬롯 hotel 승인 전화 없는 토토 사이트 and casino opened in 2019. 해외 안전 놀이터 The new, upscale hotel casino opened 바카라 사이트 추천 in 2015. Now, the 한게임포커머니상 casino's 5,000-square-foot space,

    ReplyDelete

Post a Comment

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -