convert the string to number angular 2 one way binding
[longitude]="loc.location.lng">
loc.location.lng is string i need to convert them to number.but still not working as I expect. In interpolation it's working but in this not working. Thanks
convert the string to number angular 2 one way binding
[longitude]="loc.location.lng">
loc.location.lng is string i need to convert them to number.but still not working as I expect. In interpolation it's working but in this not working. Thanks
You could also force the cast by trying this:
[longitude]="+loc.location.lng"
loc.location.lng is null?Make a function which convert the value to float as its location and return the value.
ConvertString(value){
return parseFloat(value)
}
Call the function in template
[longitude]="ConvertString(loc.location.lng)"