Reputation: 13
I'm working on Project MVC, Angular js I have a problem that I show modal and in initiate fun i load a number of questions on the basis of user choose his subject and then opening the pop up modal with questions But I do not know the modal open but without any questionds at first i Load skill page and from this page user select his subject and then popup modal opened after search i think the problem because of modal loaded when skill page load so after open modal no questions appeared how can i reload modal or solve this problem Hint : when pass function in init with values it worked and questions appeares but when pas values values passes aright and beduge is correct but popup open as empity For example ng-init =" ReadQuizQuestions (11, true)" working good but when ReadQuizQuestions (secItem.Id, secItem.hasQuiz) not working can any one help me to solve this problem
in skill page
<div class="badge_unit heading_font video_course_preview" ng-
click="ReadQuizQuestions(secItem.Id,secItem.hasQuiz)"></div>
in angular js file
$scope.ReadQuizQuestions = function (id,hasQuiz) {
if (hasQuiz == true) {
ShowPleaseWait();
QuizService.ReadQuiz(QuizId).success(function (res) {
.
.
.
.......
$('#QuizModal').modal('show');
});
HidePleaseWait();
}
}
Thanks in advance
Upvotes: 0
Views: 1037
Reputation: 428
In this exemple i passed parameters from my controller to the modal (list of questions)
To pass the parameter you need to use resolve and inject the items in controller of modal.
$modal.open({
emplateUrl: 'myModal.html',
controller: 'ModalDialogController',
resolve: {
questionsList: function () {
return $scope.questionsList;
}
}
})
.result.then(function(result) {
alert(result);
});
After selecting your question and validate i reyrn the selected value to my controller with
$scope.ok = function () {
$modalInstance.close($scope.modal.selectedName);
};
Upvotes: 1