Hello to all,

I finally dropped the idea of viewbag and solved the problem like that

<div ng-hide="myarray[0].myfield== 0 ">Content</div>

Thank you all for the replies

On Wed, Aug 3, 2016 at 8:31 AM, Marina L <[email protected]> wrote:

> Hello,
>
> thank you for your reply
>
> The
>
> <div ng-if="@ViewBag.total">
>
> doesn't work for me. I notice that I cannnot even call my ViewBag
> variable. Lets say that I have a viewbag in my mvc controller like that
>
>  ViewBag.total = "hello"
>
> and then in my View I do this
>
> @ViewBag.total
>
> It doesn't display nothing. Is there any conflict between razor syntax and
> angularjs?
>
> thank you
>
>
>
> On Tue, Aug 2, 2016 at 4:01 PM, Ali Al Lawati <[email protected]> wrote:
>
>> Hi there Marina L
>>
>>
>> Do this
>>
>> <div ng-if="@ViewBag.total">
>>> content here
>>>         </div>
>>>
>>>
>> On Monday, August 1, 2016 at 12:40:50 PM UTC+4, Marina L 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 a topic in the
>> Google Groups "AngularJS" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/angular/wo8R1zVlq-U/unsubscribe.
>> To unsubscribe from this group and all its topics, 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.

Reply via email to