The second day I try to get AngularJS to show Yandex Map using ya-maps
The reason I can’t do this is probably the most trivial, therefore, please don’t blame me, I first learned what Angular is the day before yesterday, and Yandex API was discovered yesterday, and considering that a project should fly in a month - time for scrupulous study not.
I will give my code, I will be very grateful if you correct it so that it will work.
index.html
<!DOCTYPE html> <html lang="ru" xmlns:vml="urn:schemas-microsoft-com:vml" ng-app="myApp" ng-controller="myController"> <head> <title></title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, maximum-scale=1" /> <link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css"> <link rel="stylesheet" href="style.css"> <script src="angular.min.js"></script> <script src="ya-map-2.1.min.js"></script> <script src="script.js" type="text/javascript"></script> </head> <body> <div id="map" class="w3-col s10 w3-dark w3-border"> <!-- <ya-map ya-zoom="8" ya-center="[37.64,55.76]" style="width:400px;height:500px;"></ya-map> --> </div> </body> </html> script.js
console.log("script starts"); var myApp = angular .module('myApp', ['yaMap']) .controller("myController", function ($scope) { console.log("In the controller"); var _map; $scope.afterMapInit = function (map) { _map = map; }; $scope.del = function () { _map.destroy(); }; console.log("After $scope ops"); $scope.initialize = function () { var mapOptions = { center: [50.5, 30.5], zoom: 8 }; ymaps.ready(function () { $scope.map = new ymaps.Map("map", mapOptions); }) } }); I hope for your help!