如何使用angularJs
本期更新,博主將給大家分享一些AngularJs常用的一些屬性和方法,AngularJS 是由 Google 的員工 Miško Hevery 從 2009 年開始著手開發(fā)。這是一個非常好的構(gòu)想,該項目目前已由 Google 正式支持,有一個全職的開發(fā)團隊繼續(xù)開發(fā)和維護這個庫。AngularJS 是一個 JavaScript 框架。它是一個以 JavaScript 編寫的庫。因此,有一定JavaScript基礎(chǔ)的朋友會更容易理解,其中的一些用法也可參照J(rèn)avascript的使用方法。
一、AngularJS入門之指令與表達(dá)式
AngularJS 通過 指令 擴展了 HTML,且通過 表達(dá)式 綁定數(shù)據(jù)到 HTML。
【AngularJS常用指令】
1、ng-app:聲明Angular所管轄的區(qū)域。一般寫在body或html上,原則上一個頁面只有一個;
<body ng-app=""></body>
2、ng-model:把元素值(比如輸入域的值)綁定到應(yīng)用程序的變量中。
<input type="text" ng-model="name"/>
3、ng-bind:把應(yīng)用程序變量中的數(shù)據(jù)綁定到 HTML視圖中??捎帽磉_(dá)式{{ }}替代;
<div ng-bind="name"></div>
<div>{{name}}</div>4、ng-init:初始化 AngularJS應(yīng)用程序中的變量。
<body ng-app="" ng-init="name=123">
5、表達(dá)式: {{}} 綁定表達(dá)式,可以包含文字、運算符和變量。但表達(dá)式在網(wǎng)頁加載瞬間會看到{{}},所以可以用ng-bind=""替代
{{ 5 +""+ 5 + ',Angular'}}
【基本概念】
1、指令:AngularJS中,通過擴展HTML的屬性提供功能。所以,ng-開頭的新屬性,被我們成為指令
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>AngularJS入門</title>
</head>
<body ng-app="" ng-init="name=123">
<input type="text" id="input" ng-model="name"/>
<div id="div" ng-bind="name+',Angular'">{{name}}</div>
<input type="text" id="input2" ng-model="name"/>
<p>我的第一個表達(dá)式: {{ 5 +""+ 5 + ',Angular'}}</p>
</body>
<script src="libs/jquery-3.1.1.js"></script>
<script src="libs/angular.js"></script>
<script type="text/javascript">
// var input1 = document.getElementById("input");
// var div = document.getElementById("div");
//
// input1.onkeyup = function(){
// div.innerHTML = input1.value;
// }
// $("#input").keyup(function(){
// $("#div").html($("input").val());
// });
</script>
</html>二、AngularJS中的MVC與作用域
[MVC三層架構(gòu)]
1、Model(模型):應(yīng)用程序中用于處理數(shù)據(jù)的部分。(保存或修改數(shù)據(jù)到數(shù)據(jù)庫、變量等)。AngularJS中的Model特指的是:數(shù)據(jù)
View(視圖):用戶看到的用于顯示數(shù)據(jù)的頁面;
Controller(控制器):應(yīng)用程序中處理用戶交互的部分。負(fù)責(zé)從視圖讀取數(shù)據(jù),控制用戶輸入,并向模型發(fā)送數(shù)據(jù)。
2、工作原理: 用戶從視圖層發(fā)出請求,controller接收到請求后轉(zhuǎn)發(fā)給對應(yīng)的model處理,model處理完成后返回結(jié)果給controller,并在view層反饋給用戶。
主要用于CRUD類應(yīng)用,不適合游戲開發(fā)和DOM操作
創(chuàng)建一個Angular模塊,即ng-app所綁定的部分,需傳遞兩個參數(shù):
① 模塊名稱,即ng-app所需要綁定的名稱。ng-app="myApp"
② 數(shù)組:需要注入的模塊名稱,不需要可為空。
var app = angular.module("myApp",[]);
在Angular模塊上,創(chuàng)建一個控制器Controller,需要傳遞兩個參數(shù)
① Controller名稱,即ng-controller需綁定的名稱。ng-controller="myCtrl"
② Controller的構(gòu)造函數(shù):構(gòu)造函數(shù)可以傳入多個參數(shù),包括$scope/$rootScope以及各種系統(tǒng)內(nèi)置對象;
[AngularJS中的作用域]
① $scope:局部作用域,聲明在$scope上的屬性和方法,只能在當(dāng)前Controller中使用;
② $rootScope:根作用域,聲明在$rootScope上的屬性和方法,可以在ng-app所包含的任何區(qū)域使用(無論是否同一Controller,或是否在Controller包含范圍中)。
>>> 若沒有使用$scope聲明變量,而直接在html中使用ng-model綁定的變量作用域為:
1.如果ng-model在某個ng-controller中,則此變量會默認(rèn)綁定到當(dāng)前Controller的$scope上;
2.如果ng-model沒有在任何一個ng-controller鐘,則此變量將綁定在$rootScope上;
app.controller("myCtrl",function($scope,$rootScope){
//$scope.name = "name1";
$rootScope.age = 14;
$scope.classes = {
name:"H51701",
num:"33"
};
});
app.controller("myCtrl1",function(){
});
三、Angular過濾器
AngularJS中,過濾器可以使用一個管道字符(|)添加到表達(dá)式和指令中。
>>> 系統(tǒng)內(nèi)置過濾器:
currency 格式化數(shù)字為貨幣格式。
filter 從數(shù)組項中選擇一個子集。
lowercase 格式化字符串為小寫。
orderBy 根據(jù)某個表達(dá)式排列數(shù)組。
uppercase 格式化字符串為大寫。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="css/bootstrap.css" rel="external nofollow" />
</head>
<body ng-app="app" ng-controller="ctrl">
<p>{{"aBcDeF"|uppercase}}</p>
<p>{{"aBcDeF"|lowercase}}</p>
<p>{{123456|currency}}</p>
<form class="form-horizontal">
</form>
<div class="form-group">
<label>請輸入篩選信息:</label>
<input type="text" ng-model="search" />
</div>
<table class="table table-bordered">
<thead>
<tr>
<th>姓名</th>
<th>年齡</th>
<th>成績</th>
</tr>
</thead>
<tr ng-repeat="item in classes| filter:search | orderBy:'score'">
<td>{{item.name}}</td>
<td>{{item.age}}</td>
<td>{{item.score}}</td>
</tr>
</table>
<p>{{"123456"|reverse}}</p>
</body>
<script src="libs/angular.js"></script>
<script>
angular.module("app",[])
.controller("ctrl",function($scope){
$scope.classes = [
{name:"張二",age:"12",score:"88"},
{name:"張三",age:"12",score:"88"},
{name:"李四",age:"15",score:"78"},
{name:"李五",age:"15",score:"78"},
{name:"王麻子",age:"18",score:"98"},
{name:"王二麻子",age:"18",score:"98"}
];
})
/*
* 自定義過濾器
*/
.filter('reverse', function() {
return function(text) {
if(!angular.isString(text)){
return "您輸入的內(nèi)容不是字符串";
}else{
return text.split("").reverse().join("");
}
}
})
</script>
</html>四、Angular服務(wù)Service
【服務(wù)Service】
1、內(nèi)置服務(wù):
>>>使用內(nèi)置服務(wù)必須在controlller中通過函數(shù)的參數(shù)注入進(jìn)來?。。?!
$location :返回當(dāng)前頁面的 URL 地址;
$http: 服務(wù)器請求數(shù)據(jù),類似于AJax;
$timeout :對應(yīng)了 JS window.setTimeout 函數(shù)。
$interval :對應(yīng)了 JS window.setInterval 函數(shù)。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body ng-app="app" ng-controller="ctrl">
<pre >{{local}}</pre>
<p ng-bind="myHeader"></p>
<p ng-bind="num"></p>
<p >{{gongneng}}</p>
<p>將255轉(zhuǎn)為16進(jìn)制:{{hexafy}}</p>
<p>{{123|filt}}</p>
<p>{{123|filt1}}</p>
</body>
<script type="text/javascript" src="libs/angular.js" ></script>
<script type="text/javascript">
angular.module("app",[])
.controller("ctrl",function ($scope,$location,$timeout,$interval,$hexafy) {
$scope.local=$location.absUrl();
$scope.myHeader = "Hello World!";
$timeout(function () {
$scope.myHeader = "How are you today?";
}, 2000);
$scope.num=0;
$interval(function () {
$scope.num++;
},1000);
$scope.gongneng=$hexafy.$$gongneng;
$scope.hexafy=$hexafy.myFunc(255);
})
/*自定義服務(wù)*/
.service('$hexafy', function() {
this.$$gongneng = "將轉(zhuǎn)入的數(shù)字,轉(zhuǎn)為16進(jìn)制";
this.myFunc = function (x) {
return x.toString(16);
}
})
.filter("filt",function(){
return function(x){
return x.toString(16);
}
})
/*在過濾器中,調(diào)用自定義服務(wù)*/
.filter("filt1",function($hexafy){
return function(x){
return $hexafy.myFunc(x);
}
})
</script>
</html>【自定義服務(wù)factory】
factory 是一個函數(shù)用于返回值,通常我們使用 factory 函數(shù)來計算或返回值。(factory使用上,與service差距不大)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="libs/bootstrap.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" />
</head>
<body ng-app="app" ng-controller="ctrl">
<p>
[功能]<br/>
{{gongneng}}
</p>
<p>
255轉(zhuǎn)成16進(jìn)制為:{{num}}
</p>
</body>
<script src="libs/angular.js"></script>
<script>
angular.module("app",[])
.config()
.controller("ctrl",function($scope,hexafy){
$scope.gongneng = hexafy.gongneng;
$scope.num = hexafy.myFunc(255);
})
.factory('hexafy',function(){
var obj = {
gongneng : "將轉(zhuǎn)入的數(shù)字,轉(zhuǎn)為16進(jìn)制",
myFunc:function(x){
return x.toString(16);
}
};
return obj;
})
</script>
</html>【自定義服務(wù)provide】
1、在AngularJS中,Service,factory都是基于provider實現(xiàn)的。
2、在provider中,通過$get()方法提供了factory的寫法,用于返回 value/service/factory。;
3、provider是三種自定義服務(wù)中,唯一可以寫進(jìn)config配置階段的一種。
如果服務(wù),必須要在配置階段執(zhí)行,那么必須使用provider。否則,一般使用Service或factory
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="libs/bootstrap.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" />
</head>
<body ng-app="app" ng-controller="ctrl">
<p>
[功能]<br/>
{{gongneng}}
</p>
<p>
255轉(zhuǎn)成16進(jìn)制為:{{num}}
</p>
</body>
<script src="libs/angular.js"></script>
<script>
angular.module("app",[])
/*在配置階段聲明procide服務(wù)!*/
.controller("ctrl",function($scope,hexafy){
$scope.gongneng = hexafy.gongneng;
$scope.num = hexafy.myFunc(255);
})
/*定義一個provider服務(wù)*/
.provider('hexafy',function(){
// this.gongneng = "將轉(zhuǎn)入的數(shù)字,轉(zhuǎn)為16進(jìn)制";
this.$get = function(){
var obj = {
gongneng : "將轉(zhuǎn)入的數(shù)字,轉(zhuǎn)為16進(jìn)制",
myFunc : function(x){
return x.toString(16);
}
}
return obj;
}
})
</script>
</html>五、Angular中的$http
$http 是 AngularJS 中的一個核心服務(wù),用于讀取遠(yuǎn)程服務(wù)器的數(shù)據(jù)。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="libs/bootstrap.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" />
</head>
<body ng-app="app" ng-controller="ctrl">
<!--<pre>
{{data}}
</pre>-->
<div class="container" style="margin-top: 50px;">
<div class="panel panel-primary" >
<div class="panel-heading">
<div class="panel-title" style="text-align: center;">H5-1701班級信息表</div>
</div>
<div class="panel-body">
<table class="table table-bordered">
<thead>
<tr>
<th>姓名</th>
<th>年齡</th>
<th>愛好</th>
<th>語文成績</th>
<th>數(shù)學(xué)成績</th>
<th>總分</th>
</tr>
</thead>
<tr ng-repeat="item in data | orderBy:'score.chinese + score.math'">
<td ng-bind="item.name"></td>
<td ng-bind="item.age"></td>
<td ng-bind="item.hobby">
<!--<span ng-repeat="a in item.hobby">{{a}}</span>-->
</td>
<td ng-bind="item.score.chinese"></td>
<td ng-bind="item.score.math"></td>
<td ng-bind="item.score.chinese + item.score.math"></td>
</tr>
</table>
</div>
</div>
</div>
</body>
<script src="libs/angular.js"></script>
<script>
angular.module("app",[])
.controller("ctrl",function($scope,$http){
$http.post('h51701.json',{/*傳遞的參數(shù)對象*/})
.then(function(res){
$scope.data = res.data;//data 從返回的信息中,取出需要的數(shù)據(jù)。為JSON對象(數(shù)組)
});
})
</script>
</html>六、Angular中的select
使用數(shù)組作為數(shù)據(jù)源。
其中,x表示數(shù)組的每一項。
默認(rèn)會將x直接綁定到option的value中。
而option顯示的內(nèi)容,有前面的x for... 決定
<select ng-model="name" ng-options="x.site for x in sites"> </select>
使用對象作為數(shù)據(jù)源.
其中,(x,y)表示鍵值對,x為鍵,y為值。
默認(rèn)會將值y綁定到option的value中.
而option顯示的內(nèi)容,有前面的x for... 決定
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="libs/bootstrap.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" />
<style type="text/css">
*{
margin: 10px;
}
</style>
</head>
<body ng-app="app" ng-controller="ctrl">
<select ng-model="name" ng-options="x for (x, y) in sites">
</select>
<div class="alert alert-info" style="width: 300px;">
您選擇的是:{{name}}
</div>
<table class="table table-bordered">
<tr>
<th>序號</th>
<th>姓名</th>
</tr>
<tr ng-repeat="item in options">
<td>{{$index +1}}</td><!--$index 表示遍歷的索引,從0開始-->
<td>{{item}}</td>
</tr>
</table>
</body>
<script src="libs/angular.js"></script>
<script>
angular.module("app",[])
.controller("ctrl",function($scope){
$scope.options = ["張三","李四","王二麻子","杰小瑞"];
$scope.sites = {
site01 : "Google",
site02 : "Runoob",
site03 : "Taobao"
};
})
</script>
</html>七、Angular中的DOM與事件
ng-disabled="true/false" 當(dāng)傳入true時,控件禁用。傳入false是,啟用;
ng-show 默認(rèn)隱藏 傳入true時顯示;
ng-hide 默認(rèn)顯示 傳入true是隱藏;
ng-click定義了AngularJS中的點擊事件。
只能觸發(fā)綁定在Angular作用域中的屬性與方法。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="libs/bootstrap.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" />
<style type="text/css">
*{
margin: 10px;
}
</style>
</head>
<body ng-app="app" ng-controller="ctrl">
<input type="checkbox" ng-model="mySwitch">是否同意我是帥哥!
</label>
<button ng-disabled="!mySwitch" class="btn btn-primary">點我!</button>
<p></p>
<label>
<input type="checkbox" ng-model="mySwitch1">是否顯示?
</label>
<button ng-show="mySwitch1" class="btn btn-primary">點我!</button>
<p></p>
<label>
<input type="checkbox" ng-model="mySwitch2">是否隱藏?
</label>
<button ng-hide="mySwitch2" class="btn btn-primary">點我!</button>
<p></p>
<button ng-click="count = count + 1">點我!</button>
<p>{{ count }}</p>
<button ng-click="func()">說一下感想吧!</button>
</body>
<script src="libs/angular.js"></script>
<script>
angular.module("app",[])
.controller("ctrl",function($scope,$rootScope){
$scope.count = 10;
$scope.func = function(){
alert("我彈了一個窗!");
}
})
</script>
</html>八、Angular表單和輸入驗證
[AngularJS中的表單驗證]
1、表單中,常用的驗證操作:
$dirty 表單有填寫記錄
$valid 字段內(nèi)容合法的
$invalid 字段內(nèi)容是非法的
$pristine 表單沒有填寫記錄
$error 表單驗證不通過的錯誤信息
2、驗證時,需給表單,及需要驗證的input,設(shè)置name屬性:
給form及input設(shè)置name后,會將form表單信息,默認(rèn)綁定到$scope作用域中。故,可以使用 formName.inputName.$驗證操作 得到驗證結(jié)果:
例如:formName.inputName.$dirty = "true" 表單被填寫過
formName.inputName.$invalid = "true" 表單輸入不合法
formName.inputName.$error.required = "true" 表單必填但未填
$error支持的驗證有:required/minlength/maxlength/pattern/email/number/date/url等。。。
3、為避免沖突,例如使用type="email"時,H5也會進(jìn)行驗證操作。如果只想使用AngularJS驗證,可以使用<form novalidate></form>屬性,禁用H5自帶驗證功能;
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="libs/bootstrap.css" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" />
<style type="text/css">
.row{
margin-bottom: 10px;
}
.row .col-xs-5{
text-align: center;
}
.suc{
border-color: #3c763d;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
}
.suc:focus{
border-color: #2b542c;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168;
}
.err{
border-color: #a94442;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
}
.err:focus{
border-color: #843534;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483;
}
</style>
</head>
<body ng-app="app" ng-controller="ctrl">
<div class="container" style="width: 40%; margin: 50px auto; padding: 0px;">
<div class="panel panel-primary">
<div class="panel-heading">
<div class="panel-title" style="text-align: center;">
用戶注冊
</div>
</div>
<div class="panel-body">
<form action="" method="get" class="form-horizontal" name="myForm" novalidate>
<div class="row" >
<div class="col-xs-3">
用戶名:
</div>
<div class="col-xs-9">
<input type="text" class="form-control" ng-model="user.name" name="name" ng-minlength="4" ng-maxlength="10" required ng-class="{suc:myForm.name.$valid && myForm.name.$dirty,err:myForm.name.$invalid && myForm.name.$dirty}"/>
<p style="color: red; margin: 0px;" ng-show="myForm.name.$invalid && myForm.name.$dirty">
<!--當(dāng)有填寫記錄且不合法時,p顯示-->
<span ng-show="myForm.name.$error.required">用戶名必須填寫?。?!</span>
<span ng-show="myForm.name.$error.minlength">用戶名最少包含4個字符?。?!</span>
<span ng-show="myForm.name.$error.maxlength">用戶名最多包含10個字符?。?!</span>
</p>
</div>
</div>
<div class="row">
<div class="col-xs-3">
郵箱:
</div>
<div class="col-xs-9">
<input type="email" class="form-control" ng-model="user.mail" name="mail" required ng-class="{suc:myForm.mail.$valid && myForm.mail.$dirty,err:myForm.mail.$invalid && myForm.mail.$dirty}"/>
<p style="color: red; margin: 0px;" ng-show="myForm.mail.$invalid && myForm.mail.$dirty">
<!--當(dāng)有填寫記錄且不合法時,p顯示-->
<span ng-show="myForm.mail.$error.required">郵箱必須填寫?。?!</span>
<span ng-show="myForm.mail.$error.email">郵箱格式不合法?。?!</span>
</p>
</div>
</div>
<div class="row">
<div class="col-xs-3">
密碼:
</div>
<div class="col-xs-9">
<input type="password" class="form-control" ng-model="user.pwd" name="pwd" pattern="^\w{6,18}$" required ng-class="{suc:myForm.pwd.$valid && myForm.pwd.$dirty,err:myForm.pwd.$invalid && myForm.pwd.$dirty}"/>
<p style="color: red; margin: 0px;" ng-show="myForm.pwd.$invalid && myForm.pwd.$dirty">
<!--當(dāng)有填寫記錄且不合法時,p顯示-->
<span ng-show="myForm.pwd.$error.pattern">密碼應(yīng)為6-18位,且只能為字母、數(shù)字、下劃線</span>
</p>
</div>
</div>
<div class="row">
<div class="col-xs-3">
確認(rèn)密碼:
</div>
<div class="col-xs-9">
<input type="password" class="form-control" ng-model="rePwd" name="rePwd" required ng-class="{suc:myForm.rePwd.$dirty&&rePwd==user.pwd,err:myForm.rePwd.$dirty&&rePwd!=user.pwd}"/>
<p style="color: red; margin: 0px;" ng-show="myForm.rePwd.$dirty && rePwd!=user.pwd">
<!--當(dāng)有填寫記錄且不合法時,p顯示-->
兩次密碼輸入不一致?。?!
</p>
</div>
</div>
<div class="row">
<div class="col-xs-5">
<input type="submit" value="注冊" class="btn btn-success" ng-disabled="myForm.$invalid || rePwd!=user.pwd" />
</div>
<div class="col-xs-5">
<input type="button" value="重置" class="btn btn-warning" ng-click="resets()" />
</div>
</div>
</form>
</div>
</div>
<pre>
{{user.pwd}}
</pre>
</div>
</body>
<script src="libs/angular.js"></script>
<script>
$scope.resets = function(){
$scope.user = angular.copy($scope.initUser);
}
$scope.resets();
})
</script>
</html>以上就是本文的全部內(nèi)容,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,同時也希望多多支持腳本之家!
相關(guān)文章
angular 實現(xiàn)的輸入框數(shù)字千分位及保留幾位小數(shù)點功能示例
這篇文章主要介紹了angular 實現(xiàn)的輸入框數(shù)字千分位及保留幾位小數(shù)點功能,涉及AngularJS數(shù)值運算、正則匹配等相關(guān)操作技巧,需要的朋友可以參考下2018-06-06
AngularJS的ng-repeat指令與scope繼承關(guān)系實例詳解
這篇文章主要介紹了AngularJS的ng-repeat指令與scope繼承關(guān)系,結(jié)合實例形式通過ng-repeat指令詳細(xì)分析了scope繼承關(guān)系,需要的朋友可以參考下2017-01-01
@angular前端項目代碼優(yōu)化之構(gòu)建Api Tree的方法
這篇文章主要介紹了@angular前端項目代碼優(yōu)化之構(gòu)建Api Tree的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-12-12
AngularJS基礎(chǔ) ng-dblclick 指令用法
本文主要介紹AngularJS ng-dblclick 指令,這里對ng-dblclick基礎(chǔ)資料整理并詳細(xì)介紹,簡單的代碼實例和實現(xiàn)效果,希望能幫助學(xué)習(xí)AngularJS的朋友2016-08-08
Angular中$broadcast和$emit的使用方法詳解
本篇文章主要介紹了Angular中$broadcast和$emit的使用方法詳解,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-05-05

