2015-07-20 67 views
0

我想提出我的離子谷歌放指令的NG模式,但它會隨時記錄未定義離子離子谷歌就地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); 
    } 
+0

你錯過''''ng按鈕''''按鈕' – Tushar

+0

@Tushar哦,對不起,但這不是真的問題 – teddybear123

+0

你沒有在'ng-click'按鈕上調用'submit'函數' – Tushar

回答

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); 
} 

這應該有效。