我用office-ui-fabric-js制作了一个jsbin。
现在我想在周围添加一个角度控制器。所以我尝试了这个JSBin:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.2.0/css/fabric.min.css">
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.2.0/css/fabric.components.min.css">
<script src="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.4.0/js/fabric.min.js"></script>
</head>
<body ng-app="YourApp">
<div ng-controller="YourController">
<div class="ms-CommandBar">
<div class="ms-CommandBar-mainArea">
<div class="ms-CommandButton">
<button class="ms-CommandButton-button">
<span class="ms-CommandButton-icon ms-fontColor-themePrimary"><i class="ms-Icon ms-Icon--CircleRing"></i></span><span class="ms-CommandButton-label">Command</span>
</button>
</div>
</div>
</div>
{{haha}}
</div>
<script type="text/javascript">
var CommandBarElements = document.querySelectorAll(".ms-CommandBar");
for (var i = 0; i < CommandBarElements.length; i++) {
new fabric['CommandBar'](CommandBarElements[i]);
}
angular.module('YourApp', ['officeuifabric.core', 'officeuifabric.components'])
.controller('YourController', ['$scope', function ($scope) {
$scope.haha = true
}])
</script>
</body>
</html>
但是,它给出了一个错误Failed to instantiate module YourApp
。有谁知道如何解决这一问题?
理论上我们可以使用office-ui-fabric
and office-ui-fabric-js
inside angular
,还是必须使用ng-office-ui-fabric
?