0
我一直在積極研究使用AngularJS和Bootstrap的應用程序。爲了幫助,我已經包含了Bootstrap UI框架。我成功地打開了一個對話框並關閉了對話框。但是,當用戶點擊「保存項目」時,我不確定如何實際「獲取」數據。在Bootstrap UI中從Modal獲取數據
如上Plunker所示,我有我的控制器定義是這樣的:
var modalInstance = $modal.open({
templateUrl: 'item-dialog.html',
size: 'sm',
controller: function($scope, $modalInstance) {
$scope.saveItem = function() {
alert('Saving...');
alert('ID: ' + $scope.newItem.typeId);
alert('Data: ' + $scope.newItem.data);
};
$scope.cancelItem = function() {
$modalInstance.close(false);
};
}
});
當我去顯示用戶所選項目的ID和文本用戶進入,它不起作用。 newItem
未定義。但是,在標記中,您可以看到ng-model="newItem.data"
如何獲取用戶在我的控制器中輸入的信息?
謝謝!