I think that's fine, but you may want to use ng-switch instead of ng-if.

On Fri, Sep 26, 2014 at 12:50 PM, Evgeny Nepomnyashchiy <
[email protected]> wrote:

> Hello guys,
>
> I'm newbie in Angular JS, I have very simple question:
> I use ng-repeat directive for showing list of data. View of each item
> depends on data, I want to use different views for different types of data.
> I use ng-if directive like this:
>
> <div ng-repeat="item in items">
>   <div ng-if="item.type == 1">
>     Type 1
>   </div>
>   <div ng-if="item.type == 2">
>     Type 2
>   </div>
>   <div ng-if="item.type == 3">
>     Type 3
>   </div>
>   ...
> </div>
>
> Is it good practice? What can you suggest me to use? How is it from
> performance perspective?
>
> Thank you!
> Have a nice weekend!
>
> --
> 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 http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
R. Mark Volkmann
Object Computing, Inc.

-- 
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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to