zoukankan      html  css  js  c++  java
  • Angular @的作用

    <!DOCTYPE html>
    <html lang="zh-cn" ng-app="myApp">
    <head>
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    <meta http-equiv="x-ua-compatible" content="IE=edge">
    <meta charset="utf-8">
    <title></title>
    </head>
    <body>
    <div ng-controller="listCtrl">
    <input type="text" ng-model="t" />
    <kid title="{{t}}" > //这个必须指定的,这里的title是指令里scope的@对应的,t就是控制域scope下的
    <span>我的angularjs</span>
    </kid>
    </div>
    <script src="js/angular.js"></script>

    <script>

    var myApp=angular.module('myApp',['ng']);
    myApp.controller('listCtrl',function($scope){
    $scope.logchore="motorola";
    });
    myApp.directive('kid',function(){
    return {
    'restrict':'E',
    scope:{
    title:"@"
    },
    template:'<div >{{title}}</div>'

    }
    });
    </script>
    </body>
    </html>
  • 相关阅读:
    晶振及COMS电路
    笔记16 C# typeof() & GetType()
    笔记15 修饰符
    笔记14 数据库编程技术
    C#基础知识
    C#连接数据库
    笔记13 winform
    笔记12 export to excel (NPOI)
    笔记11 export to excel
    笔记10
  • 原文地址:https://www.cnblogs.com/dianzan/p/7284539.html
Copyright © 2011-2022 走看看