angularJS directive自定义标签和属性

本文深入探讨了AngularJS中的directive特性,如何自定义元素、属性和样式。通过示例展示了'E'、'A'、'C'和'M'的不同用法,并详细解释了template、transclude、scope以及link函数的功能。scope中的name1、name2和name3分别对应双向绑定、文字绑定和方法调用,最后提到了link中执行的函数及其参数。
摘要由CSDN通过智能技术生成

directive可以自定义标签和属性,首先看一个例子:

<html ng-app="testModule">
<head>
    <meta charset="utf-8">
    <title>My HTML File</title>
    <link rel="stylesheet" href="css/app.css">
    <link rel="stylesheet" href="css/bootstrap.css">
    <script src="lib/angular/angular.js"></script>
</head>
<body ng-controller="testController">
    <input type="text" ng-model="person">
    <hello person="person">
	<div>
	    {
  {person}}
	</div>
    </hello>
<p>{
  {a}}</p>
<script>
    var testModule=angular.module('testModule',[]);
    testModule.controller('testController',function($scope){
	    $scope.person="Tony";
    });
    testModule.directive('hel
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值