0

i created one index page which have "NavigationController" and bind the menu on index page. when i redirect to new page controller and inject it "NavigationController" to bind latest menu on next page but it always display old menu. when i refresh the page then it loads nice with new menu.

<nav class="static-sidebar" role="navigation">
                <ul ng-controller="NavigationController" id="sidebar" ng-init="!layoutLoading">
                    <li ng-repeat="item in menu" ng-include="'templates/nav_renderer.html'" ng-show="{{item.hasRights}}" ng-cloak></li>
                </ul>

And Controller with my factory method which return meun is :

$scope.menu = GetHttpRequest.GetMenu();

Now, I Add into Another page i.e

<div ng-controller="NavigationController"></div>

but this not load latest menu untill i refresh the page

so , can you help me in this?

2
  • Please Create a plunker that reproduced the same issue. Commented Jul 29, 2016 at 3:25
  • can u provide plunker Commented Jul 29, 2016 at 4:17

2 Answers 2

1

{{}} not needed in ng-show.

Use ng-show="item.hasRights" instead of ng-show="{{item.hasRights}}"

Sign up to request clarification or add additional context in comments.

1 Comment

I could show only this error from your abov code. Create plunker/fiddle to find the exact one
0

If it works after refreshing it means that it is something with loading order in your site. Check if you have correct order of loading, like: vendor lbirariers -> your libraries -> (...) -> your controller

also check your dependency injection headers in js files, cause you might skipped something

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.