定義的錯誤在我HomeCtrl.js
我從另一個功能initialize()
調用函數currentLocation()
,我定義這個機能的研究,但它給我的功能錯誤沒有被定義的:\ 代碼更新但仍同樣的錯誤發生 有人可以告訴我什麼是我的代碼中的問題?角JS:功能未在控制器
HomeCtrl.js
'use strict';
angular.module('Home').controller('HomeCtrl',['$scope','$state','MessageService', function($scope, $state, $ionicModal, MessageService) {
(function initialize(){
var location = $scope.currentLocation();
$scope.mapOptions = {
mapTypeControl: true,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: location
};
})();
$scope.currentLocation = function(){
navigator.geolocation.getCurrentPosition(function(pos) {
$scope.position = new google.maps.LatLng(pos.coords.latitude, pos.coords.longitude);
return $scope.position;
});
};
}]);
我有更新我的代碼,請檢查頂部...還是同樣的錯誤內容時發生 –
@mariasalahuddin與更新檢查控制器在答案 – Sajeetharan