how to call function outside of javascript file

Home / javascript / how to call function outside of javascript file

Question:
i am calling one function ng-change in my html and in my controller
this my HTMl
ng-change="valueset(selectedAddress);"

function inside my controller
$scope.valueset=function(val){
globalvar=val.latitude;
sessionStorage.setItem(‘latitude’,globalvar);
console.log(‘Setting globalvar’+sessionStorage.getItem(‘latitude’));
}

javascript file
window.gs.prototype.jsfunction = function(){
var city= new ol.Feature({
geometry: new ol.geom.Point(
ol.proj.fromLonLat(
[4.342342,
parseInt(sessionStorage.getItem(‘latitude’))
]))
});
}

in my javascript file when i am calling sessionStorage.getItem(‘latitude’) i am getting value first time but i want to change value in javascript file whenever my input value change. i have defined global variable out of controller globalvar="";


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *