AngularJS ng-repeat with custom element inside a table is rendering strangely

前端 未结 3 1303
不知归路
不知归路 2020-12-08 04:58

I\'m trying to re-use a portion of my HTML view in multiple places. The portion I want to re-use is table cells in an HTML table. The problem is that my custom directive i

3条回答
  •  清歌不尽
    2020-12-08 05:26

    Apply the directive to like this:

    app.directive('myElement', function () { return { restrict: 'A', scope:{ ngModel: '=blah' }, template: 'Name: {{ ngModel.name }}Age: {{ ngModel.age }}' } });

    Working Demo

提交回复
热议问题