zoukankan      html  css  js  c++  java
  • 指令隔离作用域 绑定策略

    @  指令模板的变量,绑定到dom里的属性的值

    = 父级作用域上的属性进行双向绑定, 父级数据模型会发生改变

    &  绑定父级作用域上的函数

    <!DOCTYPE html>
    <html lang="en" ng-app="myApp">
    <head >
        <meta charset="UTF-8">
        <title>Title</title>
        <script type="text/javascript" src="angular.js"></script>
    
    </head>
    <body>
        <div ng-controller="parentController" >
            <input ng-model="indexx" type="text"  aa="hhh"/>
            <son-dir  dd=indexx  aa="hhh">   //指令的父级  在此可以添加属性与指令内部模板进行传值   若是引用  用 dd ={{index}}  若是双向绑定  则 dd = index
    </
    son-dir> </div> </body> <script> (function(){ var parentController = function($scope){ $scope.indexx = "dsaf"; } var sonDir = function(){ return{ restrict:"AE", scope:{ dd:"@aa" }, template:"<input ng-model=dd type='text'/><span>{{dd}}</span>" } } angular.module("myApp",[]) .controller("parentController",parentController) .directive("sonDir",sonDir ); })(); </script> </html>
  • 相关阅读:
    20-存储过程
    21-事务
    18-触发器
    19-函数
    16-pymysql模块的使用
    17-视图
    CodeForces 1369B. AccurateLee
    CodeForces 1312D.Count the Arrays(组合数学)
    CodeForces 1362D. Johnny and Contribution
    CodeForces 1363F. Rotating Substrings
  • 原文地址:https://www.cnblogs.com/RonnieQin/p/9116575.html
Copyright © 2011-2022 走看看