Error when using Chosen jQuery plugin along with AngularJS
I am using Chosen jQuery plugin with AngularJS.
The function Show_Selected_Number() is called from Angular_Controller. The
alert($scope.Number); should output selected number. Unfortunately the
selected number is displayed correctly only once.
If selection is revised, the alert function shows the actual selection +
1. So upon selecting 1, the alert box shows 2, if 2 is selected the alert
box shows 3 and so on...
The following is HTML.
head
script(type='text/javascript', src='js/jquery.min.js')
script(src='js/chosen.jquery.min.js')
script(type='text/javascript', src='js/angular.min.js')
script(type='text/javascript', src='js/angularFile.js')
link(href='css/chosen.css', rel="stylesheet", type="text/css");
script.
$(document).ready(function(){
$(".chosen-select").chosen();
});
body(ng-app)
.formDiv(ng-controller='Angular_Controller')
form(ng-submit='Show_Selected_Number()')
select(data-placeholder="Choose Number",
ng-model="Number").chosen-select
option(value= '1') 1
option(value= '2') 2
option(value= '3') 3
option(value= '4') 4
The following is the angularFile.js included above:
function Angular_Controller($scope){
$scope.Show_Selected_Number = function() {
alert($scope.Number);
}
}
No comments:
Post a Comment