您的位置:首页 > Web前端 > AngularJS

AngularJS基本功能

2016-03-16 14:45 726 查看
// 创建模块
var myApp = angular.module("myApp", []);

// 创建控制器
myApp.controller("myCtrl", function($scope) {
$scope.msg = "ok";
});

// 创建过滤器
myApp.filter("myFilter", function() {
return function(input) {
return input.toUpperCase();
}
});

// 创建指令
myApp.directive("myDctv", function() {
return function(scope, element, attrs) {
element.bind("mouseenter", function() {
element.css("background", "yellow");
});
element.bind("mouseleave", function() {
element.css("background", "none");
});
}
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  AngularJS