Tuesday, 15 February 2011

angularjs - HTML in directive attributes -


Is it a good idea to give the HTML string as a directive in AngularJS? Like:

  & lt; Tile data-content = "& lt; b & gt; some text & lt; / b & gt;" & Gt; & Lt; / Tile & gt;   

This is just an example, the string will actually be very long and more complex. I'm creating a tile directive that shows a model window with additional content on click I know that it is a string like any other, but I think that is a better way

I recommend that you take a look at this:

  & lt ; Tile & gt; & Lt; B & gt; Some text & lt; / B & gt; & Lt; / Tile & gt;   

I would say that it is most suitable

Otherwise if the material is dynamic then I will put it in a model and it will pass it to the director. If not, I will pass an identifier for a partial HTML file which will be downloaded and inserted using the service.

No comments:

Post a Comment