I want to call the function on click the Get OTP
Please find the code which is in html files
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset = “utf-8” >
<title> Todo </title>
<meta name = “viewport” content = “initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width” >
<link href = “css/style.scss” rel = “stylesheet” >
<link href = “lib/ionic/css/ionic.css” rel = “stylesheet” >
<script src = “lib/ionic/js/ionic.bundle.js” ></script>
<script src = “js/app.js” ></script>
<script src = “js/controllers.js” ></script>
<!-- <script src=“js/sqlQueries.js”></script>–>
<script src = “js/messages.js” ></script>
<script src = “login/controllers/loginCtrl.js” ></script>
<!-- Needed for Cordova/PhoneGap (will be a 404 during development) -->
<script src = “cordova.js” ></script>
</head>
<body ng-app = “todo” class = “platform-ios platform-cordova platform-webview” >
<ion-nav-bar class = “appBGGreenColor” >
</ion-nav-bar>
<ion-nav-view ></ion-nav-view>
</body>
</html>
Login.html
<ion-view ng-controller = “loginCtrl” ng-init = “doSomething()” >
<ion-nav-title > Login Screen </ion-nav-title>
<ion-content class = “appBGGreenColor” >
<div class = “list paddContent appDefaultTopMargin appBGGWhiteColor leftRightMargin” >
<div>
<center><ion-label > Login </ion-label></center>
<br>
<div class = “paddingContents” > <h5 > Urban Ghats will Send a SMS to your Mobile Number </h5><div>
<label class = “item item-input” >
<span class = “input-label” > Mobile Number </span>
<input type = “number” placeholder = “Please enter mobile number” ng-model = “login.mobile” >
</label>
<br>
<center><button class = “button button-dark button-small center” ng-click = “selectTab()” >
Get OTP
</button></center>
</div>
</div>
</ion-content>
</ion-view>
JavaScripts code
angular.module(‘todo’, [‘ionic’])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs).
// The reason we default this to hidden is that native apps don’t usually show an accessory bar, at
// least on iOS. It’s a dead giveaway that an app is using a Web View. However, it’s sometimes
// useful especially with forms, though we would prefer giving the user a little more room
// to interact with the app.
if (window.cordova && window.Keyboard) {
window.Keyboard.hideKeyboardAccessoryBar(true);
}
if (window.StatusBar) {
// Set the statusbar to use the default style, tweak this to
// remove the status bar on iOS or change it to use white instead of dark colors.
StatusBar.styleDefault();
}
});
})
.config(function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state(‘index’, {
url: ‘’,
templateUrl: ‘/login/templates/login.html’,
controller: ‘loginCtrl’
});
$urlRouterProvider.otherwise(‘login1.html’)
})
loginCtrl.js
angular.module(‘starter.controllers’)
.controller(‘loginCtrl’, function($rootScope,$scope,$state) {
$scope.login={};
$scope.doSomething=function(){
console.log(“doSomething”)
}
$scope.login=function(){
console.log(“ok”)
console.log($scope.login.mobile)
}
$scope.selectTab = function() {
console.log($scope.login.mobile)
// $scope.tab = item;
//Your other logic for soothe
};
});
Let me know what mistake is there ?