是否可以動態更改全局樣式表?是否可以動態更改Angular 2中的全局樣式表?
編輯:其目的是讓用戶選擇他喜歡的風格。
在Angular 1中,我能夠在頭標上包裹控制器並在其中使用綁定。下面
實施例(簡化代碼):
的index.html
<!DOCTYPE html>
<html ng-app="app" ng-controller="AppController">
<head>
<title>Title</title>
<link rel="stylesheet" ng-href="styles/{{current}}"/>
</head>
...
AppController的
app.controller('AppController', ['$scope', function ($scope) {
$scope.current = dynamicValue;
}]);
這是可能在角2?
你試過了嗎?發生了什麼? – Jamiec
你想通過動態改變鏈接標籤來完成什麼?可能有不同的方式來實現相同的功能。 :) – Harangue