angularjs directive scope 与父scope双向绑定

参考 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>

猜你喜欢

转载自www.cnblogs.com/white-knight/p/8960826.html
今日推荐