I am working on project with ionic framework which is use AngularJS, its possible to convert the following code form jQuery to AngularJs ?
jQuery(function($) {
var states = {
'USA': ['Arizona','California','Colorado','D.C','Florida','Georgia','Hawai','Indiana'],
'Canada':['Canada'],
}
var cities = {
'Arizona': [
'Phoenix','Tucson'],
}
var $states = $('#state');
$('#country').change(function() {
var country = $(this).val();
var states_op = states[country] || [];
var html = $.map(states_op, function(sts) {
return '<option valie ="' + sts + '">' + sts + '</option>'
}).join('');
$states.html(html);
});
var $cities = $('#city');
$('#state').change(function() {
var state = $(this).val();
var cities_op = cities[state] || [];
var html = $.map(cities_op, function(sts) {
return '<option valie ="' + sts + '">' + sts + '</option>'
}).join('');
$cities.html(html);
});
});
i use 3 select tags which the last on with city id send request in ByCityTag controller.
Is posible to "convert" somehow this code form jQuery to AngularJS?