Md 对话框弹出框 (angular-material) 作为新视图加载 (Yeoman)
Md-dialog popup box (angular-material) loads in as a new view (Yeoman)
所以我用 Yeoman (angular-fullstack, angular-material) 创建了一个项目,当我点击 div 然后 md-对话框应该显示。现在发生的是我的页面被加载两次并且没有弹出窗口可见,尽管您确实看到了覆盖 (http://gyazo.com/c5e05ca2045c3ed9c32bb38d7bf67fc9)。我猜它认为我的 dialog1.tmpl.html 是一个全新的观点。那么我该如何解决这个问题呢?
我用于触发弹出窗口的部分代码:
$scope.showPopUp = function(ev) {
$mdDialog.show({
controller: DialogController,
templateUrl: 'dialog1.tmpl.html',
parent: angular.element(document.body),
targetEvent: ev,
})
function DialogController($scope, $mdDialog) {
if (editId) {
$http.get('/api/task/' + editId).success(function(data) {
console.log("data variabele uit de dialogController", data);
$scope.task_name = data.name;
$scope.task_project_id = data.project_id;
globalTask_Project = data.project_id;
$scope.task_location = data.location_id;
globalTask_location = data.location_id;
$scope.task_estimate_time = data.estimate_time;
$scope.task_project_client_name = data.project_client_name;
$scope.task_url = data.url;
$scope.task_resource_link = data.resource_link;
$scope.task_notes = data.task_notes;
$scope.closeDialog = function() {
var mainApp = angular.element(document.body).controller();
$mdDialog.hide();
editId = null;
globalTask_location = null;
globalTask_Project = null;
}
})
.error(function(data, status, headers, config) {
console.log("Error in retrieving data from server");
});
} else {
$scope.closeDialog = function() {
var mainApp = angular.element(document.body).controller();
$mdDialog.hide();
}
}
}
}
这个问题的解决方案是我必须正确设置我的 templateUrl 的路由,而不是 templateUrl: 'dialog1.tmpl.html' 它必须是 templateUrl: 'app/calendar/month/dialog1.tmpl.html'
所以我用 Yeoman (angular-fullstack, angular-material) 创建了一个项目,当我点击 div 然后 md-对话框应该显示。现在发生的是我的页面被加载两次并且没有弹出窗口可见,尽管您确实看到了覆盖 (http://gyazo.com/c5e05ca2045c3ed9c32bb38d7bf67fc9)。我猜它认为我的 dialog1.tmpl.html 是一个全新的观点。那么我该如何解决这个问题呢?
我用于触发弹出窗口的部分代码:
$scope.showPopUp = function(ev) {
$mdDialog.show({
controller: DialogController,
templateUrl: 'dialog1.tmpl.html',
parent: angular.element(document.body),
targetEvent: ev,
})
function DialogController($scope, $mdDialog) {
if (editId) {
$http.get('/api/task/' + editId).success(function(data) {
console.log("data variabele uit de dialogController", data);
$scope.task_name = data.name;
$scope.task_project_id = data.project_id;
globalTask_Project = data.project_id;
$scope.task_location = data.location_id;
globalTask_location = data.location_id;
$scope.task_estimate_time = data.estimate_time;
$scope.task_project_client_name = data.project_client_name;
$scope.task_url = data.url;
$scope.task_resource_link = data.resource_link;
$scope.task_notes = data.task_notes;
$scope.closeDialog = function() {
var mainApp = angular.element(document.body).controller();
$mdDialog.hide();
editId = null;
globalTask_location = null;
globalTask_Project = null;
}
})
.error(function(data, status, headers, config) {
console.log("Error in retrieving data from server");
});
} else {
$scope.closeDialog = function() {
var mainApp = angular.element(document.body).controller();
$mdDialog.hide();
}
}
}
}
这个问题的解决方案是我必须正确设置我的 templateUrl 的路由,而不是 templateUrl: 'dialog1.tmpl.html' 它必须是 templateUrl: 'app/calendar/month/dialog1.tmpl.html'