1
僅在Chrome for iOS中發生。 我有這樣的HTML。iOS Chrome和AngularJS不在HEAD中執行控制器
<html ng-app="MY_APP">
<head ng-conroller="headCtrl as head">
<title ng-bind="head.title"></title>
... libraries...
<link rel="stylesheet" type="text/css" ng-href="./css/{{ head.style }}.css"/>
</head>
<body ng-controller="mainCrtl as main">
</body>
</html>
問題是headCrtl不能在iOS版Chrome中執行。
MY_APP.controller('headCtrl', ['$rootScope', '$scope', '$location', function ($rootScope, $scope, $location) {
var vm = this;
var host = $location.host();
if (host.indexOf('site1') > -1) {
vm.style = 'site1';
} else
if (host.indexOf('site2') > -1) {
vm.style = 'site2';
}
$rootScope.brandCode = vm.style;
vm.title = 'Straps';
}]);
謝謝你的任何建議。
您好,我有同樣的問題。你知道它爲什麼不起作用嗎?如果你有解決方案告訴我:) – 2015-10-22 08:42:21