Search code examples
angularjsangularjs-directiveng-viewng-hide

How can I hide certain contents of index.html page in an angular ng-view?


I was wondering whether I can hide certain sections on the index.html file when I access a view in angularjs.

My index.html file contains a bottom menu bar on all the views and I have created a home.html view where I don't want to include that menu bar. Is this possible with angular?

Thanks!


Solution

  • Yes you can do this

    for example you have your bottom bar as

    <div>This is bottom bar<div>
    

    Now change that to

     <div ng-hide="hideit">This is bottom bar<div>
    

    now in the controller of home.html just write $rootScope.hideit = true;

    Any where in application you want to keep bottom bar visible just do $rootScope.hideit = false;