I'm kinda noob with AngularJS I have the next div:
<div ng-app="" ng-controller="telController">
Teléfono: <input type="text" ng-model="telefono.numero" ><br>
<input type="text" ng-model="telefono.tras" >
<br>
El telefono es: {{telefono.telefonoCodificado()}}
</div>
The angularjs function is:
function telController($scope) {
$scope.telefono = {
numero: "",
telefonoCodificado: function() {
var x;
x = $scope.telefono;
var parte1;
parte1= $scope.telefono.numero;
var telCodificado = parte1.substring(0, 3)+"-"+parte1.substring(3, 6)+"-"+parte1.substring(6, 10);
return "A) "+x.numero+" <<>> "+ telCodificado;
},
tras : function(){
var y;
y = $scope.telefono.numero;
return y;
}
};
}
I want the input with ng-model='telefono.tras' get filled with the value that have been typing in the input ng-model="telefono.numero" but that doesn´t happend, what am I doing wrong?