亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
AngularJS API Reference auto auto/service auto/service/$injector auto/service/$provide ng ng/directive ng/directive/a ng/directive/form ng/directive/input ng/directive/input[checkbox] ng/directive/input[date] ng/directive/input[dateTimeLocal] ng/directive/input[email] ng/directive/input[month] ng/directive/input[number] ng/directive/input[radio] ng/directive/input[text] ng/directive/input[time] ng/directive/input[url] ng/directive/input[week] ng/directive/ngApp ng/directive/ngBind ng/directive/ngBindHtml ng/directive/ngBindTemplate ng/directive/ngBlur ng/directive/ngChange ng/directive/ngChecked ng/directive/ngClass ng/directive/ngClassEven ng/directive/ngClassOdd ng/directive/ngClick ng/directive/ngCloak ng/directive/ngController ng/directive/ngCopy ng/directive/ngCsp ng/directive/ngCut ng/directive/ngDblclick ng/directive/ngDisabled ng/directive/ngFocus ng/directive/ngForm ng/directive/ngHide ng/directive/ngHref ng/directive/ngIf ng/directive/ngInclude ng/directive/ngInit ng/directive/ngKeydown ng/directive/ngKeypress ng/directive/ngKeyup ng/directive/ngList ng/directive/ngModel ng/directive/ngModelOptions ng/directive/ngMousedown ng/directive/ngMouseenter ng/directive/ngMouseleave ng/directive/ngMousemove ng/directive/ngMouseover ng/directive/ngMouseup ng/directive/ngNonBindable ng/directive/ngOpen ng/directive/ngPaste ng/directive/ngPluralize ng/directive/ngReadonly ng/directive/ngRepeat ng/directive/ngSelected ng/directive/ngShow ng/directive/ngSrc ng/directive/ngSrcset ng/directive/ngStyle ng/directive/ngSubmit ng/directive/ngSwitch ng/directive/ngTransclude ng/directive/ngValue ng/directive/script ng/directive/select ng/directive/textarea ng/filter ng/filter/currency ng/filter/date ng/filter/filter ng/filter/json ng/filter/limitTo ng/filter/lowercase ng/filter/number ng/filter/orderBy ng/filter/uppercase ng/function ng/function/angular.bind ng/function/angular.bootstrap ng/function/angular.copy ng/function/angular.element ng/function/angular.equals ng/function/angular.extend ng/function/angular.forEach ng/function/angular.fromJson ng/function/angular.identity ng/function/angular.injector ng/function/angular.isArray ng/function/angular.isDate ng/function/angular.isDefined ng/function/angular.isElement ng/function/angular.isFunction ng/function/angular.isNumber ng/function/angular.isObject ng/function/angular.isString ng/function/angular.isUndefined ng/function/angular.lowercase ng/function/angular.module ng/function/angular.noop ng/function/angular.toJson ng/function/angular.uppercase ng/object ng/object/angular.version ng/provider ng/provider/$animateProvider ng/provider/$compileProvider ng/provider/$controllerProvider ng/provider/$filterProvider ng/provider/$httpProvider ng/provider/$interpolateProvider ng/provider/$locationProvider ng/provider/$logProvider ng/provider/$parseProvider ng/provider/$rootScopeProvider ng/provider/$sceDelegateProvider ng/provider/$sceProvider ng/service ng/service/$anchorScroll ng/service/$animate ng/service/$cacheFactory ng/service/$compile ng/service/$controller ng/service/$document ng/service/$exceptionHandler ng/service/$filter ng/service/$http ng/service/$httpBackend ng/service/$interpolate ng/service/$interval ng/service/$locale ng/service/$location ng/service/$log ng/service/$parse ng/service/$q ng/service/$rootElement ng/service/$rootScope ng/service/$sce ng/service/$sceDelegate ng/service/$templateCache ng/service/$timeout ng/service/$window ng/type ng/type/$cacheFactory.Cache ng/type/$compile.directive.Attributes ng/type/$rootScope.Scope ng/type/angular.Module ng/type/form.FormController ng/type/ngModel.NgModelController ngAnimate ngAnimate/provider ngAnimate/provider/$animateProvider ngAnimate/service ngAnimate/service/$animate ngCookies ngCookies/service ngCookies/service/$cookies ngCookies/service/$cookieStore ngMessages ngMessages/directive ngMessages/directive/ngMessage ngMessages/directive/ngMessages ngMock ngMock/function ngMock/function/angular.mock.dump ngMock/function/angular.mock.inject ngMock/function/angular.mock.module ngMock/object ngMock/object/angular.mock ngMock/provider ngMock/provider/$exceptionHandlerProvider ngMock/service ngMock/service/$exceptionHandler ngMock/service/$httpBackend ngMock/service/$interval ngMock/service/$log ngMock/service/$timeout ngMock/type ngMock/type/angular.mock.TzDate ngMockE2E ngMockE2E/service ngMockE2E/service/$httpBackend ngResource ngResource/service ngResource/service/$resource ngRoute ngRoute/directive ngRoute/directive/ngView ngRoute/provider ngRoute/provider/$routeProvider ngRoute/service ngRoute/service/$route ngRoute/service/$routeParams ngSanitize ngSanitize/filter ngSanitize/filter/linky ngSanitize/service ngSanitize/service/$sanitize ngTouch ngTouch/directive ngTouch/directive/ngClick ngTouch/directive/ngSwipeLeft ngTouch/directive/ngSwipeRight ngTouch/service ngTouch/service/$swipe
characters

AngularJS: API: ng/directive/ngClass

ngClass

  1. - directive in module ng

ngClass指令允許你動(dòng)態(tài)設(shè)置HTML元素的CSS類(lèi),通過(guò)綁定到一個(gè)包含要添加的所有類(lèi)的表達(dá)式。

這個(gè)指令有三種使用方式,這三種方式取決于表達(dá)式計(jì)算結(jié)果:

  1. 如果表達(dá)式結(jié)果為字符串,則字符串為使用空格分隔的一個(gè)或多個(gè)類(lèi)名。

  2. 如果表達(dá)式結(jié)果為一個(gè)數(shù)組,則數(shù)組中每個(gè)元素為使用空格分隔的一個(gè)或多個(gè)類(lèi)名字符串。

  3. 如果表達(dá)式結(jié)果為一個(gè)對(duì)象,對(duì)象中的每個(gè)key-value中如果鍵值為真時(shí)則鍵名作為類(lèi)名。

這個(gè)指令不會(huì)添加重復(fù)的類(lèi),如果這個(gè)類(lèi)已經(jīng)存在的話。

當(dāng)表達(dá)式改變時(shí),以前添加的類(lèi)會(huì)被移除,并且只會(huì)添加之后新產(chǎn)生的類(lèi)。

指令信息

  • 這個(gè)指令執(zhí)行優(yōu)先級(jí)為0.

用法

  • 作為屬性使用:
    <ANY
      ng-class="">
    ...
    </ANY>
  • 作為CSS類(lèi)使用:
    <ANY class="ng-class: ;"> ... </ANY>

動(dòng)畫(huà)

add - 在類(lèi)被應(yīng)用到元素前發(fā)生

remove - 在類(lèi)從元素移除前發(fā)生

點(diǎn)擊這里 了解更多關(guān)于涉及動(dòng)畫(huà)的步驟。

參數(shù)

參數(shù) 類(lèi)型 詳述
ngClass expression

用于計(jì)算的表達(dá)式。 計(jì)算結(jié)果可以為使用空格分隔的類(lèi)名字符串、數(shù)組,或布爾值的類(lèi)名映射(map)表。如果是映射表,那些值為真的屬性名稱將作為css類(lèi)添加到元素上。

示例

下面演示使用ngClass指令的一些基本綁定用法。

index.html
<p ng-class="{strike: deleted, bold: important, red: error}">Map Syntax Example</p>
<input Type="checkbox" ng-model="deleted"> deleted (apply "strike" class)<br>
<input Type="checkbox" ng-model="important"> important (apply "bold" class)<br>
<input Type="checkbox" ng-model="error"> error (apply "red" class)<hr>
<p ng-class="style">Using String Syntax</p>
<input Type="text" ng-model="style" placeholder="Type: bold strike red"><hr>
<p ng-class="[style1, style2, style3]">Using Array Syntax</p>
<input ng-model="style1" placeholder="Type: bold, strike or red"><br>
<input ng-model="style2" placeholder="Type: bold, strike or red"><br>
<input ng-model="style3" placeholder="Type: bold, strike or red"><br>
style.css
.strike {
  text-decoration: line-through;}.bold {
    font-weight: bold;}.red {
    color: red;}
protractor.js
var ps = element.all(by.css('p'));

it('should let you toggle the class', Function() {

  expect(ps.first().getAttribute('class')).not.toMatch(/bold/);
  expect(ps.first().getAttribute('class')).not.toMatch(/red/);

  element(by.model('important')).click();
  expect(ps.first().getAttribute('class')).toMatch(/bold/);

  element(by.model('error')).click();
  expect(ps.first().getAttribute('class')).toMatch(/red/);});

it('should let you toggle string example', Function() {
  expect(ps.get(1).getAttribute('class')).toBe('');
  element(by.model('style')).clear();
  element(by.model('style')).sendKeys('red');
  expect(ps.get(1).getAttribute('class')).toBe('red');});

it('array example should have 3 classes', Function() {
  expect(ps.last().getAttribute('class')).toBe('');
  element(by.model('style1')).sendKeys('bold');
  element(by.model('style2')).sendKeys('strike');
  element(by.model('style3')).sendKeys('red');
  expect(ps.last().getAttribute('class')).toBe('bold strike red');});

動(dòng)畫(huà)

下面的例子演示使用ngClass來(lái)操作動(dòng)畫(huà)。

index.html
<input id="setbtn" Type="button" value="set" ng-click="myVar='my-class'">
<input id="clearbtn" Type="button" value="clear" ng-click="myVar=''"><br>
<span class="base-class" ng-class="myVar">Sample Text</span>
style.css
.base-class {
  -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
  transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;}

.base-class.my-class {
  color: red;
  font-size:3em;}
protractor.js
it('should check ng-class', Function() {
  expect(element(by.css('.base-class')).getAttribute('class')).not.
    toMatch(/my-class/);

  element(by.id('setbtn')).click();

  expect(element(by.css('.base-class')).getAttribute('class')).
    toMatch(/my-class/);

  element(by.id('clearbtn')).click();

  expect(element(by.css('.base-class')).getAttribute('class')).not.
    toMatch(/my-class/);});

ngClass 和 已經(jīng)存在的 CSS3 Transitions/Animations

ngClass指令仍然支持CSS3 Transitions/Animations 事件上,如果它們不遵從ngAnimate CSS 命名結(jié)構(gòu)的話。在動(dòng)畫(huà)階段,ngAnimate將用于輔助CSS類(lèi)來(lái)跟蹤動(dòng)畫(huà)的開(kāi)始和結(jié)束。但這并不妨礙任何元素上已經(jīng)存在的CSS轉(zhuǎn)換。要想了解基于類(lèi)的動(dòng)畫(huà)過(guò)程中發(fā)生了什么,可參見(jiàn) $animate.addClass 和 $animate.removeClass。


Previous article: Next article: