こんにちは、私は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そして、のStudentController自体edit-student.htmlをモデル データとして使用したいと考えています。この機能のためにscope、NgDialog のプロパティを as として使用できますscope:$scope(LINE 1 を参照)。
今、 Angular-StyleGuideStudentControllerで 提案されているように、 inをまったく使用しないように変更しようとしています。その場合、どのようにアクセスできますか?$scopecontrollerstudentedit-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.
});
}
更新: 混乱を避けるために詳細を更新しました。