0

私の問題のシナリオは、コントローラーを介して動的に 1 つの名前を既に取得しており、現在、その名前を ng-repeat 内にバインドしようとしていることです。どうやってやるの?何か提案をください。ngrepeat で動的な名前を取得する方法はありますか?

例:

<div ng-controller="bookCtrl">
    <div ng-repeat="tag in {{a}}.tags">
        <input type="text" ng-model="tag"/>
    </div>

    My tags are <b>really</b>: {{ book.tags }}
</div>

angular.module('myApp', [])
.controller('bookCtrl', function($scope) {
    $scope.a=book;
    $scope.book = {
        name: 'A Game of Thrones',
        tags: [
            'Tyrion',
            'John Snow',
            'Arya',
            'Sean Bean'
        ]
    };
});

ここにフィドルのリンクがあります。

4

1 に答える 1