I'm trying to do google maps with angular js without using the 'uiGmapgoogle-maps' and I'm unable to get the map using the scope.Where as I"m able to achieve this using plain js.May I know where I'm doing the mistake?
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.firstName = "John";
$scope.googleMap = function() {
alert()
$scope.mapOptions1 = {
center: new google.maps.LatLng(51.508742, -0.120850),
zoom: 9,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
$scope.map1 = new google.maps.Map(document.getElementById("googleMap1"), $scope.mapOptions1);
return map1;
}
});
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
First Name: <input type="text" ng-model="firstName"><br>
<div id="googleMap1" ng-model="googleMap()" style="width:100%;height: 228px;"></div>
</div>