Can someone assist with fixing this script?
html:
<input type="text" ng-model="phone" id="phoneInput" ng-change="apt.changePhoneInput(phone)">
js:
var app = angular.module('app', []);
app.controller('Appctrl', Appctrl, '$scope');
function Appctrl($scope){
this.changePhoneInput = function(phone) {
var result = phone;
console.log('phone', phone);
result.replace(/[^+0-9\(\)]/gim,'');
console.log('result', result);
$scope.phone = result;
};
}
I am aiming to allow only numbers and specific symbols like '+', '(', ')', '-' in the input field. However, it seems like the replace function is not working properly after the entry of certain symbols.