How to bind, display and use a value (that is taken from the slide bar) in an input text field?


I am trying to modify a loan calculator example using Ionic Framework. What I am trying to do is to bind the value of the slide bar and the value that is in the input field. When I slide the slide bar let’s say to the value of 10, I want the text field input to display a value of 10 as well. And when I increase or decrease the number using the up and down arrows I want the value in the text field to not jump back to 0 again, but to start from the value that is the same with the slide bar. I have tried using ng-bind, ng-controller, ng-model and ng-change and only using placeholder at the moment but I know I shouldn’t use placeholder.

Below are the codes so far:


<!DOCTYPE html>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/" rel="stylesheet">

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>

    <!-- your app's js -->
    <script src="js/app.js"></script>
  <body ng-app="starter">

      <ion-header-bar class="bar-stable">
        <h1 class="title">Payment Calculator</h1>



        <form name="MyForm">
            <div class="range range-assertive" ng-controller="ListCtrl" >
                <div class="list card">
                    <label class="item item-input">
                        <span class="input-label">Loan Amount</span>
                            <input type="number" name="MyTextField" id="loan.amount" value="{{user.value}}"  ng-model="user.value" ng-change="myChange(user.value)" ng-bind="user.value" placeholder=
                    <i class="icon ion-social-euro-outline"></i>
                        <input type="range" min="{{user.min}}" max="{{user.max}}" value="{{user.value}}" step="1" ng-model="user.value" ng-change="myChange(user.value)" ng-bind=
                        <span ng-bind="user.value"></span>  
                    <i class="icon ion-social-euro"></i> 

                    <label class="item item-input">
                        <span class="input-label">Periods</span>
                            <input type="number" id="periods" value= "{{periods.value}}" ng-model="periods.value" ng-change="myChange(periods.value)" placeholder="{{periods.value}}">
                    <i class="icon ion-social-euro-outline"></i>
                        <input type="range" min="{{periods.min}}" max="{{periods.max}}" value="{{periods.value}}" step="1" ng-model="periods.value" ng-change=
                    <i class="icon ion-social-euro"></i>  

                    <label class="item item-input">
                        <span class="input-label">Rate</span>
                        <input type="number" id="rate" value= "{{rate.value}}" ng-model="rate.value" ng-change="myChange(rate.value)" placeholder="{{rate.value}}">
                    <i class="icon ion-social-euro-outline"></i>
                        <input type="range" min="{{rate.min}}" max="{{rate.max}}" value="{{rate.value}}" step="1" ng-model="rate.value" ng-change="myChange(rate.value)">
                    <i class="icon ion-social-euro"></i> 

            <button onclick="pmtCalc()" class="button" style="margin: 1em 1em 1em 1em">Calculate</button><br>  

            <div class="list">
                <label class="item item-input">
                    <span class="input-label">Answer</span>
                    <p type="number" id="ANSWER"></p>

            <!--<p id="POWER"></p>-->

                function pmtCalc() {
                L = parseFloat(document.getElementById("loan.amount").value);
                P = parseFloat(document.getElementById("periods").value);
                R = parseFloat(document.getElementById("rate").value);

                N = L * R/12/100;
                D = 1 - Math.pow(1+(R/12/100),-P);

                ANS = N/D
                document.getElementById("ANSWER").innerHTML = ANS;
                /*document.getElementById("POWER").innerHTML = D;*/




// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'

var app = angular.module('starter', ['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)
    if(window.cordova && window.cordova.plugins.Keyboard) {
    if(window.StatusBar) {

app.controller('ListCtrl', function($scope) {

    $scope.user= {


    $scope.periods= {


    $scope.rate= {



So how can I bind the slider value to the input field so that when I change the slider value, the input field value change together as well and vice versa?