app.controller('FilterController', ['$scope', '$http',
function($scope,$http) {
//Loading the data to the filter scope
$http.get('/main').success(function(response){
$scope.data = response;
});
//The object that the input fields in the modal bind to
$scope.selected = {};
this.applyFilter = function(){
$http.post('/main/query', $scope.selected).success(function(response){
//The response is the filtered object sent by the server
console.log(response); //This is the response I want to bind to the main view
//Do something to pass the response to the main scope
});
};
}]);
該模式包含一些下拉菜單,供用戶選擇參數,並將這些參數保存到'selected'變量中,然後發送到數據庫以查詢一組新數據。 現在面臨的挑戰是將這些新數據發送到主範圍並刷新頁面。我做了一些研究,發現它似乎可以通過解決方案來完成,但我不確定如何將代碼放在一起。請幫助..如何將我從模態獲得的數據發送到主視圖?
回去再學習的榜樣,最終實現它是$ modalInstance.close ()方法,這是做魔術,謝謝你! – user2901633 2015-03-26 06:49:14