我正在嘗試將TextAngular集成到我的網站中。將TextAngular集成到已使用AngularJS的應用程序中
我已經使用AngularJs和用戶界面指令的其他功能,這些工作正常,但是當我嘗試添加TextAngular時,一切都會崩潰並死亡。
註冊我的模塊在一個JavaScript文件,之後TextAngular和AngularJS是其中添加的頂部,我已經爲TextAngular此處添加代碼:
angular.module('myApp', []);
angular.module('myApp', ['ui.bootstrap']);
//The above works for ui directives, I added this
angular.module('myApp', ['textAngular']);
我已經添加了文本角度捆綁:
bundles.Add(new ScriptBundle("~/bundles/textAngular").Include(
"~/Scripts/textAngular.js"));
這裏是我的編輯代碼:
<div ng-controller="wysiwygeditor" class="container app"">
<h1>Editor</h1>
<div text-angular="text-angular" name="htmlcontent" ng-model="htmlcontent"></div>
<textarea ng-model="htmlcontent" style="width: 100%"></textarea>
<div ng-bind-html="htmlcontent"></div>
<div ta-bind="text" ng-model="htmlcontent"></div>
<button type="button" ng-click="htmlcontent = orightml">Reset</button>
</div>
@Scripts.Render("~/bundles/textAngular")
<script type="text/javascript">
function wysiwygeditor($scope) {
$scope.orightml = '<h2>Try me!</h2>';
$scope.htmlcontent = $scope.orightml;
};
</script>
這是一個局部視圖,_Layout頁面包含大量的twitter引導程序內容。
就像我說的,AngularJS和UI指令工作得很好,但是當我嘗試在TextAngular中連線時,它只是不想工作。
我在Chrome中得到的錯誤是有點神祕:
Error: [$sce:unsafe] Attempting to use an unsafe value in a safe
context. errors.angularjs.org/1.2.2/$sce/unsafe
at localhost:25332/Scripts/angular.js:78:12
at htmlSanitizer localhost:25332/Scripts/angular.js:12162:13
at getTrusted localhost:25332/Scripts/angular.js:12329:16
at Object.sce.anonymous function [as getTrustedHtml] localhost:25332/Scripts/angular.js:13027:16
at Object.ngBindHtmlWatchAction [as fn] localhost:25332/Scripts/angular.js:16993:25
at Scope.$digest localhost:25332/Scripts/angular.js:11501:27
at Scope.$apply localhost:25332/Scripts/angular.js:11740:24
at localhost:25332/Scripts/angular.js:1297:15
at Object.invoke localhost:25332/Scripts/angular.js:3633:25
at doBootstrap localhost:25332/Scripts/angular.js:1295:14
我在做什麼錯在這裏?如果您需要查看更多代碼,請發表評論。
感謝