cost 124 ms
ng-style 在 angularjs ionicapp 中不起作用

[英]ng-style not working in angularjs ionicapp

我對看起來像 ng-style 的東西有疑問,但我懷疑這也可能是一個范圍界定問題。 HTML代碼; js代碼: 我想要實現的是,如果有數據,圖標顏色為紅色;如果沒有,圖標顏色為灰色。 我已經在 SO 上四處張望,當然也用 Google 搜索過,但我還沒有解決這個問題! ...

Angular ngStyle 可以取多個 function 嗎? 如果沒有,解決方法是什么?

[英]Can Angular ngStyle take more than one function? What's the workaround if not?

使用 ngStyle,你能為多個屬性添加多個條件嗎? 我需要根據某個 JSON 值更改文本顏色和背景顏色。 背景資料: 我正在努力制作一個類似於瀏覽器的標簽欄。 在每個選項卡中都有一個header/title和subheader 。 子標題的樣式根據選項卡/數組數據而變化。 這是標簽欄設計的樣子: ...

ngStyle 設置整個網頁的背景顏色

[英]ngStyle to set background color of whole web page

<body [ngStyle]="{'background':'blue'}"></body>我想將整個網頁設置為藍色。 我試過像這樣使用 height=100% 和 width=100% <body [ngStyle]="{'background':getColor ...

使用 css 和 [ngStyle] 問題隱藏輔助滾動條

[英]Hiding Secondary scrollbar with css and [ngStyle] question

所以我有這個頁面,內容是動態添加的,但是有些內容需要滾動,我不想有兩個滾動條,太丑了。 我嘗試了一些東西,但似乎沒有任何效果 css 現在看: 另外我想檢查一下這段代碼是否有一些不兼容的地方 背景顏色適用,但是當圖像加載它消失時,我可以通過控制台輸入它,但我認為我在這里遺漏了一些東西。 有沒有辦法 ...

將 ngStyle 應用於 html 頁面中的所有 p 標簽

[英]Applying ngStyle to all p tags within an html page

我目前正在為一個 Angular 項目編寫代碼,該項目會根據用戶選擇主題來動態更改顏色。 選擇主題后,它會從 api 中獲取所需顏色的十六進制代碼來為應用程序設置主題,為此我想將主題顏色應用於所有文本。 目前,我可以通過 ngStyle 將其單獨應用於每個 p 標簽,方法是將其鍵入為<p [n ...

從組件內將 CSS 樣式應用於角度組件

[英]Apply CSS style to angular componet from within the component

如果我使用以下 html 創建一個非常簡單的 Angular 組件: 組件打字稿文件包含 1 個輸入 我想在 css 網格中使用組件,但是當組件在 dom 中呈現時,它被包裝在組件的元素中 因此,在上面的示例中,我試圖將組件定位在網格中,但它不能作為 div 中的 css 屬性而不是組件 ...

如何將多個 object 屬性應用於 ngStyle

[英]How to apply multiple object property to ngStyle

我的 HTML 中有一個元素,如下所示: <span [ngStyle]="{'background': getColor(selectedOption.type)}">BLAH</span> 我的 TS 文件中有這樣的條件: 基本上,如果用戶選擇“常規”,我希望從 fun ...

Angular - 如何使用 [ngstyle] 將 object 動態傳遞給 div 元素

[英]Angular - How to pass object dynamically to div element using [ngstyle]

我正在嘗試使網格行和網格列從 API 動態填充。 組件.html 組件.ts 這種方式在控制台中它正在打印但它沒有反映在 UI 中。 控制台圖像當我嘗試手動填充數據時它工作正常 在 Inspect Element 模式下,屬性顯示為enter image description here 我在哪里犯 ...

Angular ngStyle

[英]Angular ngStyle

我對 ngStyle 有問題,我根據懸停變量放置樣式。 它有效,但我一直看到警告 我的功能 我試過 和 問題出在哪兒? 謝謝你的幫助 在此處輸入圖片說明 ...

如何使用 [ngStyle] 將樣式應用於 *ngFor 中的選定元素?

[英]How to use [ngStyle] to apply styling to a selected element in *ngFor?

我將有多個按鈕,並且需要使用 forms 來設置按鈕樣式。 每個按鈕應該能夠得到自己特定的 styles。 在下面的示例中,我嘗試單擊列表中的一個按鈕到 select 它,然后單擊一個單獨的按鈕以使用[ngStyle]將 styles 應用於所選按鈕。 到目前為止,一切似乎都在工作,除了沒有應用通 ...

ngStyle 意外行為,不更新屬性更改

[英]ngStyle unexpected behavior, not updating on property change

我有點困惑為什么ngStyle沒有按預期工作。 我正在學習 Brad Traversy 在 Udemy 上的教程,我們被指示使用ngStyle ,如下所示: <h3 [ngStyle]="currentStyles" >{{user.firstName}} {{user.lastName ...

如何為多個條件編寫內聯 ng 樣式

[英]How to write inline ng-style for multiple conditions

我正在嘗試以這種格式為多個條件編寫內聯 ng 樣式; <div ng-style="thisCondition && {'background-color':'black'},thisCondition2 && {'color':'green'}"> 但是 ...

為什么在頁面渲染過程中會多次調用 [ngStyle]?

[英]Why [ngStyle] is called many times during page rendering?

我有一個使用[ngStyle] = "getStyle()"的 Angular 頁面,當我運行該頁面時,似乎 getStyle() 已被多次調用。 誰能解釋為什么會發生這種行為? 模板: <div class="toast" data-autohide="false" [ngStyle]= ...

使用 Angular 中的單擊事件動態更改 ngStyle

[英]Dynamically change ngStyle with click event in Angular

我希望在單擊不同按鈕時更改元素的顏色,但我似乎找不到不斷檢查我的 boolean 值的解決方案。 這是我的代碼: 組件.ts: HTML: 到目前為止,代碼有效。 當組件加載時,它會檢查他們是否喜歡評論並相應地更改顏色。 但是,如果我按下向下箭頭,我希望顏色也會改變。 組件.ts: 這確實更新了 ...

Angular 如何在 [ngStyle] 和 class 上應用條件。 如果條件為真 [ngStyle] 運行,否則 class 運行

[英]Angular how may I apply condition on [ngStyle] and class. That if condition true [ngStyle] runs otherwise class runs

組件.Html 在這里,我有一個來自我的 Component.css 的類(infoSection)和來自 component.ts 的 [ngStyle]=FooterStyle,我想提出一個條件: 我已經口頭寫下了 div 標簽中的條件。 但我不知道如何做到這一點的確切語法現在我正在編寫來自 c ...

Ngstyle 隨機選擇項目

[英]Ngstyle selects items randomly

我在 Angular 中遇到了 ngstyle 的問題。 當我有一個 ngstyle 必須滿足的條件並且它確實滿足時,它要么改變 html 元素的背景,要么不改變,而且它是完全隨機的。 前任。 對於 122,它會加載一次 GIF 而不是一次,而且是隨機的該過程首先從 this.data 中提取一個數 ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM