Angularjs directive scope is two-way binding with the parent scope

Reference http://www.jb51.net/article/83051.htm

 

angluar.module("aaa").directive("testDirective", function() {

  return {

    scope : {

     param1 : "=",

     param2 : "="

    },

    template : "<input ng-model='param1' /><input ng-model="param2" />"

  }

});

 

<div test-directive="true" param1="parent.pa1" param2="parent.pa2"></div>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324975862&siteId=291194637