Access scope of form input fields

how can i access the scope of username and password as shown below in ionic . when i use this code im getting

screenshot

error

html code

<ion-view view-title="Login"  hide-nav-bar="true">
  <ion-content>
   <div class="list list-inset">
          <label class="item item-input">
              <input type="text" placeholder="Username" ng-model="data.username">
          </label>
          <label class="item item-input">
              <input type="password" placeholder="Password" ng-model="data.password">
          </label>
      </div>
      <button class="button button-block button-calm" ng-click="login()">Login</button>
  </ion-content>
</ion-view>

controller.js

. controller(‘login_pg’, function($scope,$location){
$scope.logindata={}

    $scope.login = function() {
    console.log("LOGIN user: " + $scope.data.username + " - PW: " + $scope.data.password);
}


})

looks like you typed something wrong…

$scope.logindata={}

should be

$scope.data={}

yes this is the correct syntax for your scope…