AngularJS ng-model form driven by ng-repeat over UI model description data how to?

前端 未结 2 1894
南笙
南笙 2020-12-22 04:09

The JSFiddle http://jsfiddle.net/vorburger/hyCTA/3/ illustrates a (working) \"UI modeling\" idea I had with AngularJS; note the form is not actually coded out in the HTML te

2条回答
  •  眼角桃花
    2020-12-22 04:57

    You are along the same lines as my own project Metawidget. Metawidget's equivalent to what you are after is covered by metawidget.angular.widgetprocessor.AngularWidgetProcessor:

    https://github.com/metawidget/metawidget/blob/master/modules/js/angularjs/src/main/webapp/lib/metawidget/angular/metawidget-angular.js

    Although I didn't find the need to use the square bracket notation (I just did foo.bar.baz). Also the magic line:

    $compile( widget )( scope.$parent );
    

    Which turns the raw HTML you instantiate dynamically into fully-functioning Angular code.

    If you get chance to take a look at Metawidget, I'd appreciate your feedback! Tutorial starts here.

提交回复
热议问题