문제

I got json (model property) like this:

[
{type:'a', val:'something'},
{type:'b', val:'something'}
]

Based on value of 'type', i need to render different html markup. I know i can accomplish it via ng-repeat and ng-if.

But wondering, if there is a better way of doing it, something like templating or such so code will be refractored and maintainable in long run?

도움이 되었습니까?

해결책

During the research, I came across few alternatives which are listed below.

  1. ngView
  2. ngInclude
  3. Angular Directives

For my requirement, I am sticking with directives instead.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top