<!DOCTYPE html>
<html lang="zh-CN" ng-app="app">
<head>
<meta charset="utf-8">
<title>ng-attr-(suffix)的用法</title>
<link rel="stylesheet" href="../bootstrap.min.css">
</head>
<body>
<div>
<p>1.正确做法:</p>
<input type="text" ng-model="suffix" placeholder="请输入input的type值">
(如:checkbox,radio,button,submit...)
<br><br>
我将随着输入的值变化:<input ng-attr-type="{{ suffix }}">
</div>
<div style="margin-top: 20px;">
<p>2.错误做法:cx="{{ cx }}"</p>
<p>这里的错误做法,并非真正的错误做法,只是有时浏览器会对属性会进行很苛刻的限制,所以不建议这样做。比如svg</p>
<div style="border: 1px solid red;width: 200px;height: 200px;">
<svg>
<circle cx="{{ cx }}"></circle>
</svg>
这里浏览器会报错
</div> 改为:ng-attr-cx="{{ cx }}"
<div style="border: 1px solid green;width: 200px;height: 200px;">
<svg>
<circle ng-attr-cx="{{ cx }}"><circle>
</svg>
这里不会报错
</div> </div> <script src="../angular.min.js"></script>
<script>
angular.module('app', [])
</script>
</body>
</html>

angularjs中ng-attr的用法的更多相关文章

  1. 详解AngularJS中的filter过滤器用法

    系统的学习了一下angularjs,发现angularjs的有些思想根php的模块smarty很像,例如数据绑定,filter.如果对smarty比较熟悉的话,学习angularjs会比较容易一点.这 ...

  2. AngularJS 中特性(attr)和属性(prop)的区别

    attr() 和 removeAttr() 方法是对特性进行处理的, 而 prop() 是对属性进行操作的 , 但是很多时候操作的东西是同一个 , 但是也是有区别的, 区别在于prop方法处理的是被 ...

  3. angularjs中ng-repeat-start与ng-repeat-end用法实例

    <!DOCTYPE html> <html lang="zh-CN" ng-app="app"> <head> <me ...

  4. angularjs中provider,factory,service的区别和用法

    angularjs中provider,factory,service的区别和用法 都能提供service,但是又有差别 service 第一次被注入时实例化,只实例化一次,整个应用的生命周期中是个单例 ...

  5. jQuery中attr()方法用法实例

    本文实例讲述了jQuery中attr()方法用法.分享给大家供大家参考.具体分析如下: 此方法设置或返回匹配元素的属性值. attr()方法根据参数的不同,功能也不同. 语法结构一: 获取第一个匹配元 ...

  6. CSS中的content和attr的用法

    问题缘起 在闲看别人网站时发现了这样的代码 <span class="hamburger icon" data-icon="C"> .icon:be ...

  7. thymeleaf中th:attr用法以及相关的thymeleaf基本表达式

    额,有人写的很好,我直接搬了 thymeleaf中th:attr用法 1.写死的单个属性值添加 th:attr="class=btn" 2.写死的多个属性值添加 th:attr=& ...

  8. AngularJS中forEach的用法

    AngularJS中当我们需要遍历某个数组的时候,我们会用到forEach语法.AngularJS中forEach的用法如下: angular.forEach(array,function(obj,i ...

  9. AngularJS中transclude用法详解

    这篇文章主要介绍了AngularJS中transclude用法,详细分析了transclude的具体功能.使用技巧与相关注意事项,需要的朋友可以参考下 本文实例讲述了AngularJS中transcl ...

  10. AngularJS中$interval的用法

    在AngularJS中$interval用来处理间歇性处理一些事情. 最常用的是: var app = angular.module("app",[]); app.controll ...

随机推荐

  1. codeforces 235 B. Let's Play Osu!

    You're playing a game called Osu! Here's a simplified version of it. There are n clicks in a game. F ...

  2. Autoit实现分割字符串,循环输出元素

    #include <MsgBoxConstants.au3> Local $aDays = StringSplit("Mon,Tues,Wed,Thur,Fri,Sat,Sun& ...

  3. ExtJS 4 组件详解

    ExtJS 4 的应用界面是由很多小部件组合而成的,这些小部件被称作"组件(Component)",所有组件都是Ext.Component的子类,Ext.Component提供了生 ...

  4. Qt Quick分组属性案例

    import QtQuick 2.4 import QtQuick.Controls 1.4 import QtQuick.Controls.Styles 1.4 import QtQuick.Win ...

  5. MySQL AB复制

    http://tonychiu.blog.51cto.com/656605/326541

  6. 手工走一次OPENSTACK安装,掉一层皮啊

    掉皮也是值得的,对OS的了解慢慢加深. 最近加入CS的Q群也学到不少.

  7. ISO7816协商模式和特定模式

    ISO7816协议的协商模式和特定模式好多使用者都搞不明白,还经常有客户电话询问,这里将其澄清一下: ISO7816协议的协商模式和特定模式由复位应答字节TA2确定,下面是TA2的字节定义 TA2的存 ...

  8. 一张图看懂片式多层陶瓷电容器(MLCC)

  9. (转载)PHP substr(),mb_substr()及mb_strcut的区别和用法

    (转载)http://blog.csdn.net/alongken2005/article/details/7098506 PHP substr()函数可以 分割文字,但要分割的文字如果包括中文字符往 ...

  10. CSS3学习笔记(新属性)

    1. 边框(圆角边框.加阴影和用图片绘制) 新增加 border-radius  box-shadow  border-image .div1{ border:2px solid purple; bo ...