Hi I have StudentController as follows,
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
});
}
}
When editStudent function is invoked, I want to open a dialog to show edit option. And I want to use the $scope.student of StudentController itself in the edit-student.html as model data. for this feature, I can use scope property of NgDialog as scope:$scope (see LINE 1).
Now I am trying to change the StudentController as suggested in the Angular-StyleGuide where I am not going to use the $scope in controller at all. In that case, how can I access student in 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.
});
}
Update : updated with more details to avoid confusion.