javascript - Return angular ngView to nothing -



javascript - Return angular ngView to nothing -

i have routes in angular script so:

app.config(function($routeprovider) { $routeprovider .when("/contact", { templateurl : "views/contact.html", controller : "generalctrl" }); });

now have links happily take me contact page so:

<a href="#contact">contact</a> <div ng-view></div>

now have link want remove view site goes looking did before user clicked on contact link. next doesn't work , refreshes page:

<a href="#">home</a>

how work? if declare in routes config, set template , controller? has none. need apply ng-leave classes view well. using angular 1.3.

just utilize $routeprovide.otherwise , utilize redirectto property redirect home template

app.config(function($routeprovider) { $routeprovider .when("/", { templateurl : 'views/home.html', controller : 'homecontroller', }); .when("/contact", { templateurl : "views/contact.html", controller : "generalctrl" }) .otherwise({ redirectto: '/' }); });

edit

<a href="#contact" ng-click="setclass = true;">contacts</a> <p ng-class="{'ng-leave': setclass}">im element that'll have ng-leave class</p> <ng-view> here view load </ng-view>

javascript html angularjs

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -