私はAngularJSを初めて使用しています。ここで私は問題に直面しています。送信ボタンがあるページがあります。送信モーダルを開く必要があり、URLのデータがモーダル内になければなりません。AngularJSのエラー
Index.htmlと::
<!doctype html>
<html ng-app="plunker">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.js"></script>
<script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.6.0.js"></script>
<script src="example.js"></script>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
</head>
<body>
<div ng-controller="ModalDemoCtrl">
<script type="text/ng-template" id="myModalContent.html">
<div class="modal-header">
<h3>Modal</h3>
</div>
<div class="modal-body">
{{items}}
</div>
<div class="modal-footer">
<button class="btn btn-warning" ng-click="cancel()">Close</button>
</div>
</script>
<button class="btn" ng-click="open()">Submit</button>
</div>
</body>
</html>
example.js:
angular.module('plunker', ['ui.bootstrap']);
var ModalDemoCtrl = function ($scope, $modal, $log, $http) {
//$scope.items = ['item1', 'item2', 'item3'];
$scope.open = function() {
debugger
$http.get("URL")
.success(function (response) {
debugger
$scope.items = response.data.Table;
console.log(response.Table);
});
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: 'ModalInstanceCtrl',
resolve: {
items: function() {
return $scope.items;
}
}
});
};
};
var ModalInstanceCtrl = function ($scope, $modalInstance, items) {
$scope.items = items;
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
};
エラーそれは空で、URL.Belowからフェッチされていないデータは、私が持っているコードですが、今のところ、モーダルが開きます送信をクリックした後にIAMが取得されます:
リソースを読み込めませんでした:サーバーは404 のステータスで応答しました発見OT)
は、リソースの読み込みに失敗しました:サーバーは
、これは間違って起こっている
(メソッド許可されていません)405の状態で、私はローカルホストのために使用しています(URL)を応答しました?誰もが助けることを願っています。前もって感謝します!!
クロムまたは郵便配達時に残りのクライアントから返されているURLを確認できます。モーダルは正常に動作しているようです。 – Sajal
@ Dev-One:yup URLはブラウザで問題なく動作しています。しかし、データはモーダル内部でフェッチされず、 'console.log()'であっても、コンソール上のオブジェクトを見ることができませんでした。 – Deborah