你好我有StudentController
如下
function StudentController($scope,StudentService){
$scope.student = StudentService. getStudent();
$scope.editStudent = function(){
return ngDialog.openConfirm({
template: 'edit-student.html',
className: 'ngdialog-theme-default',
scope : $scope // LINE 1
});
}
}
调用函数时editStudent
,我想打开一个对话框以显示编辑选项。我想在模型数据中使用$scope.student
ofStudentController
本身。edit-student.html
对于这个特性,我可以使用scope
NgDialog 的属性作为scope:$scope
(见第 1 行)。
现在我正在尝试按照Angular-StyleGuideStudentController
中 的建议更改我根本不打算使用in的地方。在这种情况下,我该如何访问?$scope
controller
student
edit-student.html
function StudentController(StudentService){
var vm = this;
vm .student = StudentService.getStudent();
return ngDialog.openConfirm({
template: 'edit-student.html',
className: 'ngdialog-theme-default',
scope : ???
// $scope is not used in this controller.
//Then what should I send instead?
// I tried using scope : vm . But it didn't work.
});
}
更新:更新了更多细节以避免混淆。