javascript - dynamically add item to angularjs ng-repeat -
i have directive generates drag/drop reorderable list add , remove functionality. if click in container, input added dynamically, type in , when type comma, value typed pushed list used ng-repeat build list. (should kinda familiar users of site :) )
this works awesome when initial object backing not null. when object begins null , try add first item (by detecting null , scope.$apply initialization)the markup not generated.
here plunk show mean. http://plnkr.co/edit/momlgpfy82khrpwxgr8v?p=preview
in app, data coming external source, can't ensure non-null lists. how can angular respond array initialization (and later push)?
set list empty array...whenevr new item pushed array angular listeners update directive
Comments
Post a Comment