当前位置: 首页 > wzjs >正文

网站页面设计报价表济南网站建设公司选济南网络

网站页面设计报价表,济南网站建设公司选济南网络,广州市网站建设科技公司,网站建设销售员初级使用可以查看视频 参考手册 注意 像ng-class,ng-value,ng-href等这些,很多都可以直接用class“{{}}” 原生写,为啥还出这些指令,是因为原生的比如刚一进页面就先出现表达式了,浏览器走到这里的时候才去解析,给用户…

初级使用可以查看视频
参考手册
注意

  • 像ng-class,ng-value,ng-href等这些,很多都可以直接用class=“{{}}” 原生写,为啥还出这些指令,是因为原生的比如刚一进页面就先出现表达式了,浏览器走到这里的时候才去解析,给用户的体验不好

ng-app

  • angular只对这个标签以内的起作用,要不就直接原生解析
  • 告诉angular核心它管理当前标签所包含的整个区域,有自动创建$rootScope(根作用域对象),如果是可以ng-app = “*” 就是模块名 ,就是那个.module('')

ng-controller=“*”,

  • 新创建一个新的作用域,然后自动new构造函数就是.controller里面名字,(name, [ s c o p e , f u n c t i o n ( scope, function( scope,function(scope) {}]),
  • 用数组的原因,是这个$scope不可以变名字,但是压缩后的代码一般都会形参变成a,b,c,d这种,所以用数组这种传,
  • 可以使用as用来面向对象,其实就是相当于new的实例可以使用原型链上的方法或属性,面向对象

ng-repeat:

遍历,里面可以用$index, $first(第一项), $middle(除了第一和最后), $last(最后一项), $odd, $even / ng-repeat-start ng-repeat-end 可以用来嵌套
先来个完整的:后面只是使用的例子

ng-init 初始化数据 ng-init=“username=‘zjap’”, 一般也不会用,但是比如嵌套循环的时候可能会用到

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>.active1 {background: red}.active2 {background: green}</style>
</head>
<body ng-app="myApp" ng-controller="Aaa"><ul><!-- 隔行换色 --><li ng-repeat="data in dataList" class="{{$odd? 'active1': 'active2'}}">{{data}}{{$odd}}</li></ul><table border="1"><!-- 这种相当于嵌套的<template v-for似的,ng-show让其隐藏要不可能影响合并> --><tr ng-show="false" ng-repeat-start="data in twoTableLitst track by $index" ng-init="outIndex=$index"></tr><tr ng-repeat="chil in data.children track by $index" ng-init="inIndex=$index"><td ng-if="inIndex == 0" rowspan="{{data.children.length}}">{{ data.name }}</td><td>{{ chil }}</td></tr><tr ng-show="false" ng-repeat-end></tr></table><script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.8.2/angular.min.js"></script><script>var m1 = angular.module('myApp', [])m1.controller('Aaa', ['$scope', function($scope) {$scope.dataList = ['aaa', 'bbb', 'ccc', 'ddd']$scope.twoTableLitst = [{name: 'aaa', children: ['11', '22']},{name: 'bbb', children: ['11', '22']},]}])</script>
</body>
</html>
<body ng-app="myApp" ng-controller="Aaa as a1"><span>{{a1.text}}</span><script src="./public/angular.js"></script><script> var m1 = angular.module('myApp', [])m1.controller('Aaa', ['$scope', FnAaa])function FnAaa($scope) {}FnAaa.prototype.text="woshi"</script>
</body>

ng-class:动态class

ng-style: 动态style

ng-href href

ng-src

ng-attr-**这个基本其他所有的属性都可以使用,因为不可能原生的都有对应的ng-属性,所以咱们就是所有属性都可以用这个eg:title

ng-disabled --$interval 不可点击

ng-readonly 只读

ng-checked 複選框选中

ng-value 输入框等的值

也可以用value=“{{}}”,但是这个体验不好,用户可能先在页面看到{{}},后期才能看到内容,所以推荐ng-value

<body ng-app="myApp" ng-controller="Aaa"><span ng-class="{active: IsDisabled}" ng-style="{color: 'yellow'}">{{ text }}</span><span ng-style="ngStyle">{{ text }}</span><span ng-class="ngClass">{{ text }}</span><a ng-href="{{ngHerf}}" ng-attr-title="{{ text }}">qubaidu</a><input type="button" ng-value="text" ng-disabled="IsDisabled"><input type="text" ng-value="text" ng-readonly="IsDisabled"><input type="checkbox" ng-checked="IsDisabled"><script src="./public/angular.js"></script><script> var m1 = angular.module('myApp', [])m1.controller('Aaa', ['$scope', '$interval', function($scope, $interval) {// setInterval --$scope.apply()let iNow = 5$scope.text = iNow + '秒'$scope.IsDisabled = true$scope.ngStyle={background: 'yellow',color: 'red'}$scope.ngClass = {active: true}$scope.ngHerf = "http://www.baidu.com"const timer = $interval(function() {iNow--$scope.text = iNow + '秒'if (iNow === 0) {$interval.cancel(timer)$scope.IsDisabled = false}}, 1000)}])</script>
</body>

ng-bind

解决{{}}闪屏问题,因为{{}} 当时浏览器不知道,到下面看到angular,再上去解析这种就会闪屏,跟ng-value似的

ng-cloak

这个就是比如用户就想用{{}}不想用ng-bind,但是想让{{}}解析出来才展示,平常时候就是display:none

ng-bind-template

这个就是比如标签中内容多个{{}},肯定用ng-bind不合适,所以就使用这个

ng-bind-html

这个就是解析成html,但是因为这个功能不常用,所以angular就设置成一个插件形式,后期需要按照模块引入就行,从这里查:https://www.bootcdn.cn/angular.js/,下面代码其实是有问题的,可能是引入的库不对,后面研究,但是写法基本是这种

ng-non-bindable // 就比如说想让{{}}展示出来,不去解析

<body ng-app="myApp" ng-controller="Aaa"><span ng-bind="text"></span><span ng-cloak>{{ text }}</span><span ng-bind-template="{{ text }}, {{text}}"></span><div ng-bind-html="htmlstr"></div><span ng-non-bindable>{{ text }}</span><script src="./public/angular.js"></script><script src="https://cdn.staticfile.org/angular.js/1.5.0-beta.0/angular-sanitize.min.js"></script><script>// alert('1')var m1 = angular.module('myApp', ['ngSanitize'])m1.controller('Aaa', ['$scope', function($scope) {$scope.text = 'nihao'$scope.htmlstr = '<h1>1111</h1>'}])</script>
</body>

ng-show,ng-hide 显示隐藏,就是css的disable的切换

ng-if dom元素显示

ng-switch

ng-open 应用于details,默认是展开还是隐藏

<body ng-app="myApp" ng-controller="Aaa"><input type="button" value="点击" ng-click="checkButton()"><span v-if="isShow">展示</span><div ng-switch on="lalal"><p ng-switch-when="1">我是1</p><p ng-switch-when="2">我是2</p><p ng-switch-default>我是其他</p></div><details ng-open="isShow"><summary>我是总体</summary><p>我是介绍</p></details><script src="./public/angular.js"></script><script> var m1 = angular.module('myApp', [])m1.controller('Aaa', ['$scope', function($scope) {$scope.isShow = true$scope.lalal = 1$scope.checkButton = function() {$scope.isShow = !$scope.isShow$scope.lalal++}}])</script>
</body>

ng-model: 跟v-model似的,双向数据绑定,但是如果比如想不时实的去更改可以使用ng-model-options和updateOn去配置

ng-include 可以引入新的html,这个在这个上面写也是报错,目前不知道到为啥

—我知道为啥了,需要放到服务器上,不是本地浏览器打开

<body ng-app="myApp" ng-controller="Aaa"><!-- 但是不起作用,不知道为啥 --><div ng-include="'moni.html'"></div><!-- 不时实,失去焦点才变 --><input type="text" ng-model="text" ng-model-options="{updateOn: 'blur'}"><span>{{text}}</span><script src="./public/angular.js"></script><script> var m1 = angular.module('myApp', [])m1.controller('Aaa', ['$scope', function($scope) {$scope.text = "我是开始"}])</script>
</body>
</html>

事件

ng-mouseenter,ng-mouseleave 移入移出

ng-click/dbclick 点击

ng-selected //下拉菜单选中

ng-change // input change事件

ng-copy ng-cut ng-paste 输入框复制,j剪切,粘贴操作

其他原生事件都可以用ng-事件名

标签指令

<a> 普通的a标签会点击刷新页面有默认行为,angluar重新封装了下,没有默认行为了

select

-- ng-options

form

-- novalidate
<body><div ng-app="myApp" ng-controller="Aaa"><!-- 默认行为点击 --><a href="">{{myColor}}</a><!-- myColor是color对象,color.name是展示的 --><select ng-options="color.name for color in colors" ng-model="myColor"></select><!-- 如果不写novalidate会有默认表单样式,比如说输入不是email,就会有红色边框,这没模拟出来 --><form novalidate><input type="email"></form></div><a href="">aaaaaaaaaaaa</a><script src="./public/angular.js"></script><script> var m1 = angular.module('myApp', [])m1.controller('Aaa', ['$scope', function($scope) {$scope.colors = [{name: 'red'}, {name: 'yellow'}]$scope.myColor = ''}])</script>
</body>

这些结合表单验证更容易理解,看3文档

http://www.dtcms.com/wzjs/197759.html

相关文章:

  • wordpress 做网课网站今日热点新闻素材
  • 长沙毕业设计代做网站价格浏览器正能量网站免费
  • 甘肃做网站的公司有哪些公司网站设计与制作
  • 司法局网站建设方案公司网站怎么弄
  • 温岭 网站制作竞价系统
  • 云南网站建设天锐科技网站建设与管理属于什么专业
  • 网站地址大全佛山快速排名
  • 新疆交通建设管理局厅网站网站快速优化排名排名
  • 做网站的准备品牌营销战略
  • 香港低价服务器seo优化网站网页教学
  • 网址大全有哪些怎样优化关键词到首页
  • 如何建设英文网站全国疫情又严重了
  • 英文版网站案例电脑培训班零基础
  • 合肥的网站建设刚刚刚刚刚刚刚刚刚刚刚刚刚刚刚
  • 网站功能及报价360站长平台
  • 做网站大概一个月多少工资深圳网络营销技巧
  • 黄冈商城网站建设宁德市安全教育平台
  • 怎么看网站banner尺寸汕头seo按天付费
  • 云浮 网站建设磁力吧
  • 旅游网站建设有哪些不足片多多可以免费看电视剧吗
  • 怎么提升网站流量谷歌seo网站推广怎么做优化
  • 做网站怎么买服务器关键词生成器在线
  • 广告设计培训内容网站seo优化总结
  • 网站右侧广告代码纵横seo
  • 网站怎么推广出去比较好爱站网关键词挖掘机
  • 做数字艺术设计的网站安徽做网站公司哪家好
  • pc端手机网站 viewport 自适应济南百度代理
  • 温州哪里有网站建设做网页设计的软件
  • 成都百度网站排名优化网站快速排名
  • 建设银行网站怎么登陆不了刚刚传来最新消息