离子离子-ogle-place ng-model undefined

时间:2015-07-20 05:55:52

标签: javascript angularjs ionic-framework google-places-api

我试图在我的ion-google-place指令中提交ng模型,但它始终记录未定义

视图:

<form ng-submit="submit()">

 <ion-google-place placeholder="Enter Address" ng-model="location" geocode-options="geocodeOptions"/>

 <button ng-click="submit()">Submit</button>

</form>

控制器:

$scope.submit = function(){
      var location = $scope.location;
     console.log(location);
     }

1 个答案:

答案 0 :(得分:0)

查看:

<form ng-submit="submit(location)">
   <ion-google-place placeholder="Enter Address" ng-model="location" geocode-options="geocodeOptions"/>
   <button ng-click="submit(location)">Submit</button>
</form>

控制器:

$scope.submit = function(location) {
    var loc = location;
    console.log(loc);
}

这应该有用。