0
我想要做的是以下幾點:如何在html註釋中使用ngIf?
<!-- directive: ng-my-if condition -->
<link rel="stylesheet" ng-href="myStyle1.css">
<link rel="stylesheet" ng-href="myStyle2.css">
<link rel="stylesheet" ng-href="myStyle3.css">
<!-- end ng-my-if -->
我試圖建立自己的ngIf
,但沒有奏效。
有沒有辦法實現這個想法?
爲什麼要使用html註釋?因爲樣式將在<head>
標籤不允許<div>
或其他標記被用來在其添加ngIf
,而且還因爲這些myStyle1.css, myStyle2.css, myStyle3.css
將使用gulp
任務與useref
插件被壓縮成一個文件.css
,所以我不能爲每個樣式標籤添加ng-if
。
也不能把link
標籤內body
和包裝它們div
因爲有link
標籤在<head>
標籤和我需要尊重他們的順序。
正如我所說,我不能用' ng-if'在'link'上自動調用那些'.css'會被壓縮並轉換成一個'link'標籤,所以所有的屬性都會被刪除。 – Dabbas
我會更新這個代碼 – Aruna
我已經更新了代碼,請看看。 – Aruna