我使用的是angularjs 1.65版本 ,它似乎$ sce讓我不明確 我一直在嘗試使用時間來修復它超過3小時。
這裏是模塊:
var app = angular.module('myApp', ['ui.router','ngclipboard','oitozero.ngSweetAlert']);
app.config(function ($stateProvider, $urlRouterProvider, $locationProvider) {})
這裏是控制器:
app.controller('monitormainController',
['$rootScope','$scope','$timeout','SweetAlert','$sce', function
($scope,$timeout,$rootScope,$watch,SweetAlert,$sce) {
$scope.copyset = function(name){ $scope.trustedHtml =
$sce.trustAsHtml(name); };
});
我得到它說$ SCE未定義
Failed to load resource: the server responded with a status of 404 (File not found) angular.js:14642 TypeError: Cannot read property 'trustAsHtml' of undefined at Scope.$scope.copyset (monitormainController.js:93) at fn (eval at compile (angular.js:15500), :4:153) at callback (angular.js:27285) at Scope.$eval (angular.js:18372) at Scope.$apply (angular.js:18472) at HTMLButtonElement. (angular.js:27290) at HTMLButtonElement.dispatch (jquery.js:5095) at HTMLButtonElement.elemData.handle (jquery.js:4766)
會很高興的錯誤得到任何答案非常感謝你!
仍然沒有工作:(,改變你的方式 同類有線IDK的怎麼說,甚至, 一切似乎 –
當你安裝示波器的時候,angularjs給你$ watch。從我讀到的內容中獲得。 –
我更新了答案;很可能你期望使用'$ scope。$ watch'而不是某些'$ watch'服務。remov應該讓與它有關的任何錯誤消失。 – Claies