Accessibility is an often overlooked essential feature of a web application. a11y Is a critical component of your AngularJS application. It should be considered early in an applications life. The ng-aria module gets you started quickly, adding instant upgrades to your Angular app's accessibility.

Want to learn more about accessibility and AngularJS? Check out this great talk:AngularJS Accessibility by Marcy Sutton at ng-europe 2014.

Read More: http://jsbin.com/jopex/2/edit

HTML  CSS  JS  Result
Edit on
<html>
<head> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0/angular-aria.js"></script>
<script src="app.js"></script>
<title>Egghead Lesson by kentcdodds</title>
</head>
<body ng-app="app" ng-controller="MainCtrl as vm">
<h1>Angular version: {{vm.angularVersion}}</h1>
<h2>
{{vm.lessonTitle || 'Angular Lesson'}}
<small>by <a href="http://twitter.com/kentcdodds">@kentcdodds</a></small>
</h2>
<hr /> <h2>Demo</h2> <form ng-init="vm.radio='1'">
Input Email:<br /><input type="email" show-attrs ng-model="vm.input" />
Textarea:<br /><textarea show-attrs ng-model="vm.textarea"></textarea> Radio:<br />
<input name="myRadio" show-attrs type="radio" ng-model="vm.radio" value="1" />
<input name="myRadio" show-attrs type="radio" ng-model="vm.radio" value="2" /> Checkbox:<br /><input show-attrs type="checkbox" ng-model="vm.checkbox" />
Range:<br /><input show-attrs type="range" ng-model="vm.range" min="0" max="25" />
Hide/Show:<input type="checkbox" ng-model="vm.show" /><input show-attrs ng-show="vm.show" ng-model="hidden" />
Invalid:<br /><input show-attrs type="email" ng-model="vm.email" />
Required:<br /><input show-attrs ng-model="vm.required" required />
Disabled:<input type="checkbox" ng-model="vm.disable" /><br /><button show-attrs type="submit" ng-disabled="vm.disable">Submit</button>
</form> </body>
</html>
/**
* Created by Answer1215 on 11/14/2014.
*/
var app = angular.module('app', ['ngAria']); app.controller('MainCtrl', function MainCtrl() {
'use strict';
var vm = this;
vm.angularVersion = angular.version.full;
vm.lessonTitle = 'How to use the ngAria module'; }); app.directive('showAttrs', function() {
return function(scope, el, attrs) {
var pre = document.createElement('pre');
el.after(pre);
scope.$watch(function() {
var attrs = {};
Array.prototype.slice.call(el[0].attributes, 0).forEach(function(item) {
if (item.name !== 'show-attrs') {
attrs[item.name] = item.value;
}
});
return attrs;
}, function(newAttrs, oldAttrs) {
pre.innerText = JSON.stringify(newAttrs, null, 2);
}, true);
}
});

Also in angular.config(), you can use $ariaProvider to disable some aria value:

  • ariaHidden – {boolean} – Enables/disables aria-hidden tags
  • ariaChecked – {boolean} – Enables/disables aria-checked tags
  • ariaDisabled – {boolean} – Enables/disables aria-disabled tags
  • ariaRequired – {boolean} – Enables/disables aria-required tags
  • ariaInvalid – {boolean} – Enables/disables aria-invalid tags
  • ariaMultiline – {boolean} – Enables/disables aria-multiline tags
  • ariaValue – {boolean} – Enables/disables aria-valuemin, aria-valuemax and aria-valuenow tags
  • tabindex – {boolean} – Enables/disables tabindex tags
var app = angular.module('app', ['ngAria'])
.config(function($ariaProvider){
$ariaProvider.config({
ariaInvalid: true
})
});

[AngularJS] Angular1.3 ngAria - 1的更多相关文章

  1. Directive Controller And Link Timing In AngularJS

    I've talked about the timing of directives in AngularJS a few times before. But, it's a rather compl ...

  2. 说说Angular中的$timeOut定时器

     非常不幸的一点是,人们似乎常常将AngularJS中的$timeOut()函数看做是一个内置的.无须在意的函数.但是,如果你忘记了$timeOut()的回调函数将会造成非常不好的影响,你可能会因此遇 ...

  3. browser-sync & http server

    browser-sync & http server browser-sync https://www.browsersync.io/ usage # step 1 $ npm install ...

  4. $timeout()定时器

    非常不幸的一点是,人们似乎常常将AngularJS中的$timeOut()函数看做是一个内置的.无须在意的函数.但是,如果你忘记了$timeOut()的回调函数将会造成非常不好的影响,你可能会因此遇到 ...

  5. [AngularJS] Angular 1.3 ngAria - 2

    This is an highlight about ngAira in Angular Document abou ngAira Where can use ngAria? Currently, n ...

  6. Angular企业级开发(1)-AngularJS简介

    AngularJS介绍 AngularJS是一个功能完善的JavaScript前端框架,同时是基于MVC(Model-View-Controller理念的框架,使用它能够高效的开发桌面web app和 ...

  7. AngularJS的基础元素应用

    <!doctype html> <!-- 标记ng-app告诉AngularJS处理整个HTML页并引导应用 --> <html ng-app> <head& ...

  8. angular1.x的简单介绍 (一)

    angular1.x作为经典的mvc框架,可以创建能够复用的组件,也可进行双向数据绑定.国内的vue.js/avaloon.js都是同类型的框架.适合使用angularjs的项目有大型信息化管理系统: ...

  9. 带你走近AngularJS - 基本功能介绍

    带你走近AngularJS系列: 带你走近AngularJS - 基本功能介绍 带你走近AngularJS - 体验指令实例 带你走近AngularJS - 创建自定义指令 ------------- ...

随机推荐

  1. Python并发编程-生产消费模型

    生产消费模型初步 #产生两个子进程,Queue可以在子进程之间传递消息 from multiprocessing import Queue,Process import random import t ...

  2. 【最小生成树】BZOJ1682[Usaco2005 Mar]-Out of Hay 干草危机

    ...最小生成树裸题,9月最后一天刷水刷水. #include<iostream> #include<cstdio> #include<algorithm> usi ...

  3. poj 2342 && hdu 1520 树形dp

    题意:有n个人,接下来n行是n个人的价值,再接下来n行给出l,k说的是l的上司是k,这里注意l与k是不能同时出现的 链接:点我 dp[i][1] += dp[j][0], dp[i][0] += ma ...

  4. java高并发程序设计模式-并发级别:阻塞、无障碍、无锁、无等待【转载】

    一般认为并发可以分为阻塞与非阻塞,对于非阻塞可以进一步细分为无障碍.无锁.无等待,下面就对这几个并发级别,作一些简单的介绍. 1.阻塞 阻塞是指一个线程进入临界区后,其它线程就必须在临界区外等待,待进 ...

  5. Android消息机制——Handler

      /**android的消息处理有三个核心类:Looper,Handler和Message.其实还有一个MessageQueue(消息队列), * 但是MessageQueue被封装到Looper里 ...

  6. 1、Redis简介、安装和基础入门

    -------------------------------------------------------- 主要内容包括: 1.Redis简介 2.Redis安装.启动.停止 3.Redis基础 ...

  7. web前端 -- 页面设计小技巧

    1:进入网页时淡入淡出的效果. <meta http-equiv=”Page-Exit”; content=”blendTrans(Duration=1.0)”> 在头部head之间加入此 ...

  8. April Fools Day Contest 2016 F. Ace It!

    F. Ace It! 题目连接: http://www.codeforces.com/contest/656/problem/F Description Input The only line of ...

  9. Redis-用思维导图二天搞定Redis用法。

    Redis整体面貌 Redis基本数据结构 1.String 1.1 数据结构 long len byte数组长度 long free 可用数组长度 char buff[] 数据内容 1.2 命令 键 ...

  10. 破解MyEclipse2015 stable3.0(亲测可用)

    整个破解过程最好断网: 1.安装好MyEclipse2015 stable3后,打开设置好工作目录后,退出.2.将plugins文件夹中的文件拷贝到myeclipse安装目录的plugins文件夹下, ...