hi, thank you for your reply. How can I pass the ViewBag (true or false) value from my mvc controller to angular controller?
On Tue, Aug 2, 2016 at 6:13 AM, hirdesh tomar <[email protected]> wrote: > Hi Marina, > > Not sure about this approach but you can use "ng-show" directive in > angular js to hide or unhide a div. > > In your controller define a flag on scope like this > > $scope.viewBagFlag = { hideShow : true }; > > and set $scope.viewBagFlag to false when your "viewBag" variable becomes > false. > > In your html use this flag to show or hide that div. > > <div ng-show="viewBagFlag.hideShow"> > </div> > > Hope this helps! > > Thanks, > Hirdesh > > On Aug 1, 2016 2:11 PM, "Marina L" <[email protected]> wrote: > >> Hello, >> >> I use Angular js in my MVC app. >> >> I need to hide a div when my viewbag is false >> >> I have try this >> >> public ActionResult Index() >> { >> ViewBag.total = false; >> return View(); >> } >> >> >> My View >> >> >> @{ >> var total= (string) ViewBag.total; >> } >> <div ng-if="total"> >> content here >> </div> >> >> >> and also this from here >> http://stackoverflow.com/questions/27673786/angular-ng-if-not-working-with-razor-syntax >> >> but it doesn't work. Any idea? >> >> thank you >> >> -- >> You received this message because you are subscribed to the Google Groups >> "AngularJS" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at https://groups.google.com/group/angular. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
