javascript - angular js - not assign value to dynamically generated textbox from controller using ng-model -


i have generated dynamic form html using angular js directive , want assign values generated textbox using values provided (values may come database or array)

when not sending parameter dynamically, run following code , assign value textbox

 $scope.submitted = function() {     $scope.title = "submitted";   }; 

but when sending dynamic value form not working.

the function got called directive after click , showing alert function value not assigning textbox model. here code

$scope.submitted = function(par) {     alert(par);      $scope.title = par;   }; 

please findout code on following plunker:

http://plnkr.co/edit/hcm7dx46fdl68axs2ol2?p=preview

the problem each dynamic directive compiled in isolated child scope. when later set outer scope property title not affect local directives scope.

what can inside of $scope.submitted function set ngrepeat child scope title , pass value directive scope config object:

$scope.submitted = function(par) {     this.title = par; // points individual ngrepeate scope object }; 

and in directive configuration:

scope: {     title: '=model',     param1: '@',     formfn: '&' }, 

and use directive this

<div dynamic param1="{{lang}}" form-fn="submitted(lang)" model="title"></div> 

demo: http://plnkr.co/edit/nb2yh0wlgeyuoqqn8ys3?p=preview


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -