dynamic id ng-repeat

后端 未结 4 539
伪装坚强ぢ
伪装坚强ぢ 2020-12-30 18:38

I am trying to set a dynamic id to my div within my ng-repeat. Let me show an example.

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-30 19:06

    To answer your question, try this:

    While the above should work, this might be not what you want really (!). Please note that this is rather rare with AngularJS to manipulate elements by referring those by id.

    You should focus on your model, declarative describe UI and let AngularJS do the rest without doing low-level DOM manipulations "by hand".

提交回复
热议问题