博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
angular
阅读量:4693 次
发布时间:2019-06-09

本文共 924 字,大约阅读时间需要 3 分钟。

1、样式相关指令

ng-class 用来给元素绑定类名

1)类名字符串,可以用空格分割多个类名

2)类名数组,数组中的每一项都会层叠起来生效

3)键值为类名,值为boolean类型,当值为true时,该类会被加在元素上。

 

ng-style用来帮顶元素的css样式

 

ng-show,ng-hide 对元素显示隐藏的控制

 

2、表单控件相关指令

ng-checked控制radio和checkbox的选中状态

ng-selected控制下拉框的选中状态

ng-disabled控制失效状态

ng-multiple控制多选

ng-readonly控制只读状态

 

3、事件绑定相关指令

ng-click

ng-change

ng-mousedown

ng-mouseenter

ng-mouseleave

ng-mousemove

ng-mouseover

ng-mouseup

ng-submit

 

 

二、service

1、factory

app.controller('myApp',function($scope,myFactory){  $scope.artist=myFactory.getArtist();  }app.factory('myFactory',function(){    var _artist='';    var service={};    service.getArtist=function(){        return _artist;    }     return service;});

2、service

app.controller('myApp',function($scope,myService){   $scope.artist=myService.getArtist();}app.service('myApp',function(){   var _artist='hello';   this.getArtist=function(){        return _artist;   }});

 

 

转载于:https://www.cnblogs.com/beng/p/3833080.html

你可能感兴趣的文章
DRF的分页
查看>>
Mysql 模糊匹配(字符串str中是否包含子字符串substr)
查看>>
python:open/文件操作
查看>>
流程控制 Day06
查看>>
Linux下安装Tomcat
查看>>
windows live writer 2012 0x80070643
查看>>
tomcat 和MySQL的安装
查看>>
11.5 内部类
查看>>
Cosine Similarity
查看>>
halt和shutdown 的区别
查看>>
git常用操作
查看>>
京东SSO单点登陆实现分析
查看>>
u-boot启动第一阶段
查看>>
MySQL批量SQL插入性能优化
查看>>
定义列属性:null,default,PK,auto_increment
查看>>
用户画像展示
查看>>
C#中StreamReader读取中文出现乱码
查看>>
使用BufferedReader的时候出现的问题
查看>>
linux安装图形界面
查看>>
博弈论之入门小结
查看>>