久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='5muYW'><tr id='5muYW'><dt id='5muYW'><q id='5muYW'><span id='5muYW'><b id='5muYW'><form id='5muYW'><ins id='5muYW'></ins><ul id='5muYW'></ul><sub id='5muYW'></sub></form><legend id='5muYW'></legend><bdo id='5muYW'><pre id='5muYW'><center id='5muYW'></center></pre></bdo></b><th id='5muYW'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='5muYW'><tfoot id='5muYW'></tfoot><dl id='5muYW'><fieldset id='5muYW'></fieldset></dl></div>
        <bdo id='5muYW'></bdo><ul id='5muYW'></ul>
      <tfoot id='5muYW'></tfoot>

    1. <small id='5muYW'></small><noframes id='5muYW'>

    2. <legend id='5muYW'><style id='5muYW'><dir id='5muYW'><q id='5muYW'></q></dir></style></legend>

        如何在角度2中動態(tài)更改css類名

        How to change the css class name dynamically in angular 2(如何在角度2中動態(tài)更改css類名)

        • <small id='DnY7D'></small><noframes id='DnY7D'>

              <tbody id='DnY7D'></tbody>
              <bdo id='DnY7D'></bdo><ul id='DnY7D'></ul>
              <legend id='DnY7D'><style id='DnY7D'><dir id='DnY7D'><q id='DnY7D'></q></dir></style></legend>

              1. <i id='DnY7D'><tr id='DnY7D'><dt id='DnY7D'><q id='DnY7D'><span id='DnY7D'><b id='DnY7D'><form id='DnY7D'><ins id='DnY7D'></ins><ul id='DnY7D'></ul><sub id='DnY7D'></sub></form><legend id='DnY7D'></legend><bdo id='DnY7D'><pre id='DnY7D'><center id='DnY7D'></center></pre></bdo></b><th id='DnY7D'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='DnY7D'><tfoot id='DnY7D'></tfoot><dl id='DnY7D'><fieldset id='DnY7D'></fieldset></dl></div>

                • <tfoot id='DnY7D'></tfoot>
                  本文介紹了如何在角度2中動態(tài)更改css類名的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我有兩個CSS類名如下

                  .icon_heart{顏色:#bdbdbd;}.icon_heart_red{顏色:#a6b7d4;;}

                  我的 HTML 有一個心形圖標(biāo)

                  <div class="icon_heart" *ngIf="showheartIcon">

                  這里我有兩個 div 標(biāo)簽,心形圖標(biāo)最初是灰色,點擊后我會將其更改為藍(lán)色.

                  這是我的 ts 文件代碼:

                   showheartIcon=true;showheartIconRed =假;setWishlistTrue(id){this.showheartIconRed = true;this.showheartIcon = false;}setWishlistFalse(id){this.showheartIconRed = false;this.showheartIcon = true;}

                  我有兩個不同顏色的圖標(biāo).

                  問題

                  是否可以更改圖標(biāo)的類別而不是兩個心形圖標(biāo)?

                  我在 JavaScript 中看到我們可以更改它w3schools 簡單的方法將類應(yīng)用于 div 標(biāo)簽,但我是 TypeScript 的新手.如何更改班級?

                  解決方案

                  <div [ngClass]="showheartIconRead ? 'icon_heart_red' : 'icon_heart'">

                  I have two CSS class name as follows

                  .icon_heart{
                       color: #bdbdbd;
                  }
                  
                  .icon_heart_red{
                      color:#a6b7d4;;
                  }
                  

                  My HTML has a heart icon

                  <div class="icon_heart" *ngIf="showheartIcon">
                      <ion-icon name="heart" (click)="setWishlistTrue(category.product_id);" class="heart"></ion-icon>
                  </div>
                  <div class="icon_heart_red" *ngIf="showheartIconRed">
                      <ion-icon name="heart" (click)="setWishlistFalse(category.product_id);" class="heart"></ion-icon>
                  </div>
                  

                  Here I have two div tags, the heart icon is of gray color initially and on clicking that I will change it to blue color.

                  Here is my ts file code:

                    showheartIcon=true;
                    showheartIconRed =false;
                  
                    setWishlistTrue(id){
                      this.showheartIconRed = true;
                      this.showheartIcon = false;
                    }
                  
                    setWishlistFalse(id){
                      this.showheartIconRed = false;
                      this.showheartIcon = true;
                    }
                  

                  I have two icons of different color.

                  Question

                  Instead of having two heart icons is it possible to change the class of the icon?

                  I have seen in JavaScript we can change it w3schools simple way to apply class to the div tag, but I am new to TypeScript. How can I change the class?

                  解決方案

                  <div 
                      [class.icon_heart]="!showheartIconRead"
                      [class.icon_heart_red]="showheartIconRead">
                  

                  or

                  <div [ngClass]="showheartIconRead ? 'icon_heart_red' : 'icon_heart'">
                  

                  這篇關(guān)于如何在角度2中動態(tài)更改css類名的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態(tài)元素 - Angular 2 amp;離子2)
                  How to reload the ion-page after pop() in ionic2(如何在 ionic2 中的 pop() 之后重新加載離子頁面)
                  Retrieve localstorage value when value is change in Ionic 2(當(dāng) Ionic 2 中的值發(fā)生變化時檢索本地存儲值)

                  1. <tfoot id='QQGXq'></tfoot>
                        <tbody id='QQGXq'></tbody>

                      <small id='QQGXq'></small><noframes id='QQGXq'>

                        • <bdo id='QQGXq'></bdo><ul id='QQGXq'></ul>

                        • <legend id='QQGXq'><style id='QQGXq'><dir id='QQGXq'><q id='QQGXq'></q></dir></style></legend>
                          <i id='QQGXq'><tr id='QQGXq'><dt id='QQGXq'><q id='QQGXq'><span id='QQGXq'><b id='QQGXq'><form id='QQGXq'><ins id='QQGXq'></ins><ul id='QQGXq'></ul><sub id='QQGXq'></sub></form><legend id='QQGXq'></legend><bdo id='QQGXq'><pre id='QQGXq'><center id='QQGXq'></center></pre></bdo></b><th id='QQGXq'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='QQGXq'><tfoot id='QQGXq'></tfoot><dl id='QQGXq'><fieldset id='QQGXq'></fieldset></dl></div>

                            主站蜘蛛池模板: 亚洲视频中文字幕 | 最新中文字幕在线 | 在线看日韩 | 日韩午夜精品 | 日韩久久成人 | 国产视频二区 | 久久精品这里 | 在线观看特色大片免费网站 | 中文字幕 在线观看 | 啪啪免费网| 一级黄色片免费在线观看 | 日本大香伊一区二区三区 | 精品一区二区三区四区五区 | 一级久久久久久 | 91电影院 | 久久成人精品视频 | 亚洲欧洲精品成人久久奇米网 | 欧美一级二级在线观看 | 色综合一区 | av资源中文在线天堂 | 激情网站 | h视频在线观看免费 | 成人久久18免费网站图片 | 日韩一区二区av | 91亚洲精品久久久电影 | 国产成人免费视频网站高清观看视频 | 国产亚洲欧美在线 | 亚洲有码转帖 | 欧美日韩国产一区二区 | 日韩成人在线网站 | 免费在线观看av的网站 | 岛国毛片在线观看 | 日韩手机在线看片 | 欧美成人一区二免费视频软件 | 日韩av成人 | 欧美五月婷婷 | 欧美日韩在线免费 | 天天操综合网站 | 欧美一级特黄aaa大片在线观看 | 不卡一区二区三区四区 | 在线不卡|