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

Verzeichnis suchen
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
Figuren

AngularJS: API: ng/directive/ngShow

ngShow

  1. - directive in module ng

ngShow指令根據(jù)ngShow屬性上表達(dá)式來(lái)顯示或隱藏給定的HTML元素。元素的顯示或隱藏是通過刪除或添加ng-hide?CSS 類到元素上來(lái)實(shí)現(xiàn)的。.ng-hide?CSS 類是在AngularJS預(yù)定義的,并且設(shè)置顯示樣式為空(使用!important標(biāo)記)。 對(duì)于CSP 模式請(qǐng)?zhí)砑?angular-csp.css?到你的html文件(參見ngCsp)。

<!-- when $scope.myValue is truthy (element is visible) -->
<div ng-show="myValue"></div>

<!-- when $scope.myValue is falsy (element is hidden) -->
<div ng-show="myValue" class="ng-hide"></div>

當(dāng)ngShow表達(dá)式計(jì)算結(jié)果為假時(shí),ng-hide CSS 類會(huì)被加到元素的class屬性中,從而讓它變?yōu)殡[藏。當(dāng)為真時(shí),ng-hide CSS 類會(huì)從元素移除,這樣元素就不會(huì)被隱藏。

為什么使用!important?

你可能想知道為什么要在ng-hide CSS類上使用!important。這是因?yàn)?.ng-hide選擇器很容易被級(jí)別更高的選擇器覆蓋。例如,一些簡(jiǎn)單的改變HTML列表?xiàng)l目的顯示樣式會(huì)讓隱藏的元素顯示。這成為了處理CSS框架時(shí)最大的問題。

通過使用!important,顯示和隱藏行為會(huì)按預(yù)期工作,而不管CSS選擇器間的任何沖突(當(dāng)!important沒用在任何相矛盾的樣式上時(shí))。如果開發(fā)者決定覆蓋樣式來(lái)改變?nèi)绾坞[藏元素,那只需要在自己的CSS代碼中配合使!important即可。

覆蓋 .ng-hide

默認(rèn)情況下,.ng-hide類使用 display:none!important格式化元素。如果你希望改變ngShow/ngHide的隱藏行為,可通過在CSS中重新定義 .ng-hide類來(lái)實(shí)現(xiàn):

.ng-hide {
  /* this is just another form of hiding an element */
  display:block!important;
  position:absolute;
  top:-9999px;
  left:-9999px;}

默認(rèn)情況下你不需要覆蓋CSS中任何東西,動(dòng)畫就會(huì)針對(duì)顯示樣式生效。

ngShow動(dòng)畫的一些注意點(diǎn)

ngShow/ngHide中動(dòng)畫的顯示和隱藏事件會(huì)在指令表達(dá)式為真或假時(shí)觸發(fā)。 這個(gè)系統(tǒng)工作方式像ngClass的動(dòng)畫系統(tǒng),除了你必須也包含!important標(biāo)記到覆蓋的顯示屬性中,這樣就可以在元素隱藏動(dòng)畫期間正確執(zhí)行。

////a working example can be found at the bottom of this page
//.my-element.ng-hide-add, .my-element.ng-hide-remove {
  /* this is required as of 1.3x to properly
     apply all styling in a show/hide animation */
  transition:0s linear all;}

.my-element.ng-hide-add-active,.my-element.ng-hide-remove-active {
  /* the transition is defined in the active class */
  transition:1s linear all;}

.my-element.ng-hide-add { ... }.my-element.ng-hide-add.ng-hide-add-active { ... }.my-element.ng-hide-remove { ... }.my-element.ng-hide-remove.ng-hide-remove-active { ... }

記住,AngularJS的1.3.0-beta.11版本里, 不需要通過阻塞動(dòng)畫過程來(lái)改變顯示屬性,ngAnimate會(huì)為你自動(dòng)處理樣式的切換。

指令信息

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

用法

  • 作為屬性使用:
    <ANY
      ng-show="">
    ...
    </ANY>

動(dòng)畫

addClass: .ng-hide - 在ngShow表達(dá)式計(jì)算結(jié)果為非真時(shí)生效,并且是在內(nèi)容被顯示前。

removeClass: .ng-hide - 在ngShow表達(dá)式計(jì)算結(jié)果為真時(shí)生效,并且是在內(nèi)容被隱藏前。

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

參數(shù)

參數(shù) 類型 詳述
ngShow expression

如果表達(dá)式為真則顯示元素,否則隱藏。

示例

index.html
Click me: <input type="checkbox" ng-model="checked"><br/><div>
  Show:
  <div class="check-element animate-show" ng-show="checked">
    <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
  </div>
</div><div>
  Hide:
  <div class="check-element animate-show" ng-hide="checked">
    <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
  </div>
</div>
glyphicons.css
@import url(//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css);
animations.css
.animate-show {
  line-height:20px;
  opacity:1;
  padding:10px;
  border:1px solid black;
  background:white;}

.animate-show.ng-hide-add.ng-hide-add-active,.animate-show.ng-hide-remove.ng-hide-remove-active {
  -webkit-transition:all linear 0.5s;
  transition:all linear 0.5s;}

.animate-show.ng-hide {
  line-height:0;
  opacity:0;
  padding:0 10px;}

.check-element {
  padding:10px;
  border:1px solid black;
  background:white;}
protractor.js
var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));

it('should check ng-show / ng-hide', Function() {
  expect(thumbsUp.isDisplayed()).toBeFalsy();
  expect(thumbsDown.isDisplayed()).toBeTruthy();

  element(by.model('checked')).click();

  expect(thumbsUp.isDisplayed()).toBeTruthy();
  expect(thumbsDown.isDisplayed()).toBeFalsy();});
Vorheriger Artikel: N?chster Artikel: