-2
我在angularjs角未捕獲的SyntaxError:意外的標記<
angular.module('app').directive('directiveName', function ($http) {
return {
restrict: 'E',
link: function (scope, element, attributes) {
$http({
method: 'JSONP',
url: attributes.resource
}).then(function (response) {
scope.rows = response.data;
console.log(scope.rows);
});
}
};
});
以下代碼,並不斷返回我下面的錯誤。
Uncaught SyntaxError: Unexpected token <
我該如何解決這個問題?
您的回覆正在返回HTML。如果URL是404 – Ibu
添加更多細節 – Sajeetharan
例如,要隨機選取一些內容,該內容由該URL返回。 –