Dynamic ng-init variable - Angularjs

后端 未结 1 974
一生所求
一生所求 2021-01-06 12:09

.coffee

@FooCtrl = ->
  $scope.products = Product.query()

.html

1条回答
  •  [愿得一人]
    2021-01-06 13:07

    The way you are doing may not work as ng-init take standard Javascript expression so {{}} would not work.

    Since javascript objects are just a key-value collection. You need to access dynamic properties using [] notation instead on . notation.

    So this

    See this fiddle i created

    0 讨论(0)
提交回复
热议问题