私は角度とノードを使用して Web アプリケーションを作成しようとしている初心者プログラマーです。angular uiモーダルを取り入れようとしていますが、問題があります。ロード時のモーダル ウィンドウは、テンプレートの html ではなく、メイン ページの html をレンダリングしているようです。ただし、以下に示すように、テンプレートはページに読み込まれています。
私が探しているのは、必ずしもここで何がうまくいかないのかに対する答えではありません (それは素晴らしいことですが) ではなく、将来的にスタックオーバーフローに頼らずに問題を特定しようとするためのトラブルシューティング手法に関するアドバイスです。
問題のスクリーンショット:
ノード コンソール:
以下は私の現在のコードです:
親コントローラーと子コントローラー (それぞれ addContent と newTerms):
angular.module('myApp.controllers', []).
controller('addContent', function ($scope, $http, $modal, $log){
$scope.items = ['item1', 'item2', 'item3'];
$scope.addTerm = function () {
var newTerm = $modal.open({
templateUrl: '../../views/partials/newTermModal.jade',
controller: 'newTerms',
resolve: {
items: function () {
return $scope.items;
}
}
});
newTerm.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
};
}).
controller("newTerms",function($scope, $modalInstance, items){
$scope.items = items;
$scope.selected = {
item: $scope.items[0]
};
$scope.ok = function () {
$modalInstance.close($scope.selected.item);
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
});
テンプレートへのパスに問題があるのではないかと考えていました-パスはコントローラーファイルの場所に関連している必要がありますか? それが私が今それを持っている方法です。どうもありがとう!