Search code examples
angularjsangular-uiangular-ui-bootstrapngrouteng-view

ngView disappears when navbar dropdown is clicked


I am trying to implement a page that contains a navbar (http://getbootstrap.com/components/ see navbar), and the content of the page is inserted from a partial html via ngView. However when the dropdown is clicked, the entire ngView portion disappears.

This is how I defined the ngView:

<div ng-controller="MainCtrl">
    <div ng-view></div>
</div>

Here is a plunker: http://plnkr.co/edit/l8GVWUiq2HRL3lXhu9xd?p=preview (Please open by clicking "Launch preview in separate window" to see the navbar) Click the navbar button "Dropdown".

If I debug the screen I can see that the ngView is not rendered at all, all I see is this:

<!-- ngView:  -->

Any ideas?


Solution

  • You should add this to the ul tag:

    ng-click="$event.preventDefault();"