scope

Scenes:

controller gets command value

 

The pseudo code is as follows:

Example:

AmqConfigController

$scope.testname = null; //Note that this must be added, otherwise undefined will appear in the output

$scope.saveOne = function(saveEsbAmqconfig) {

console.log("model==================="+saveEsbAmqconfig.sender);

console.log("testname==================="+$scope.testname);

}

jsp

<div class="col-md-9 col-md-offset-1" data-ng-controller="AmqConfigController">

<input type="text" class="form-control" test-name="testname" name="senderName" data-ng-model="saveEsbAmqconfig.sender" data-person-directive="">

</div>

 

instruction

app.directive( 'personDirective',['UrlManager','$modal',function(urlManager,$modal){

   return {

   restrict : 'ECAM',  

   scope: {

   testName: '=', 

   ngModel: '='

   },

       link: function(scope,elem,attr){

       elem.bind('click',function(){

           $modal.open({

           templateUrl : urlManager.$staticViewUrls.$getUrl( 'static/esb/html/amqconfig/option-view' ),

backdrop : 'false',

controller : ['$scope', '$modalInstance','PlatformService',function($scope,) {

scope['testName']=JSON.stringify("name-------------");

scope['ngModel']=JSON.stringify("ngModel---------");

});

 

////////////////////////

$scope.testname = null; //Note, this must be added, otherwise undefined will appear in the output, because this property cannot be found in the scope, ~~~~~~~~~~~~~ Looking for it for almost a day The reason is, the result is that colleagues help to get it, I cried. . . . . . . . .

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326944171&siteId=291194637