Angularjs 手机号码应自动获取网络名称并圈出-Ionic 1
我正在开发一个ionic v1应用程序,当我输入手机号码时,网络名和圈名应该在下拉列表中自动更新,就像PayTM等应用程序一样 我已经有了一个数据库,其中网络已经根据手机号码的前4位进行了划分。键入手机号码时如何传递请求 请提出一些这样做的想法Angularjs 手机号码应自动获取网络名称并圈出-Ionic 1,angularjs,cordova,jquery-mobile,ionic-framework,Angularjs,Cordova,Jquery Mobile,Ionic Framework,我正在开发一个ionic v1应用程序,当我输入手机号码时,网络名和圈名应该在下拉列表中自动更新,就像PayTM等应用程序一样 我已经有了一个数据库,其中网络已经根据手机号码的前4位进行了划分。键入手机号码时如何传递请求 请提出一些这样做的想法 名字: 检查 var-app=angular.module('myApp',[]); 应用程序控制器('formCtrl',函数($scope){ $scope.number; $scope.submit=函数(编号){ 控制台日志(编号) var r
名字:
检查
var-app=angular.module('myApp',[]);
应用程序控制器('formCtrl',函数($scope){
$scope.number;
$scope.submit=函数(编号){
控制台日志(编号)
var res=数字切片(0,4);
console.log(res)
}
});
将“res”值发送到服务器,使用该4位值搜索数据库表,获取网络的详细信息您可以使用角度1 ng更改 View.html
<input type="text" ng-model="mobilenumber" ng-change="updateotherfields()" />
<input type="text" ng-model="mobilenumber" ng-change="updateotherfields()" />
app.controller('yourCtrl', function($scope) {
$scope.mobilenumber;
$scope.updateotherfields = function(){
if($scope.mobilenumber){
//check the length
if($scope.mobilenumber.length > 4){
console.log($scope.mobilenumber);
var firstfournumbers = $scope.mobilenumber.slice(0, 4);
//now you have your fournumbers
//Do you server code and then update the combobox Model
}
}
}
});