Code Monkey home page Code Monkey logo

Comments (10)

houqp avatar houqp commented on July 16, 2024

hi, can you show us how you define the directive inside html? you should also bind center value on directive initilization

from angular-leaflet-directive.

mikekay01 avatar mikekay01 commented on July 16, 2024

Well, for whatever reason I can't insert the html. It doesn't show.

Basically I have a "leaflet" tag and markers="markers" plus center="center" in the opening tag statement.

from angular-leaflet-directive.

mikekay01 avatar mikekay01 commented on July 16, 2024

Here's an image of it...
111

from angular-leaflet-directive.

houqp avatar houqp commented on July 16, 2024

have you defined the center property on controller initialization? also don't use extend to change the value in scope, assign a new value to it directly:

$scope.center.lat = item.latitude;
$scope.center.lng = item.longitude;
$scope.markers.store = {
    lat: item.latitude,
    lng: item.longitude,
    message: "Drag me to your position",
    focus: true,
};

from angular-leaflet-directive.

mikekay01 avatar mikekay01 commented on July 16, 2024

I guess I don't understand how this all fits together.

  1. Do I even need to pass the "item" variable to the extend function?
  2. Do I need to call $scope.addMarker? and if so, where would I call it... once on init?

from angular-leaflet-directive.

mikekay01 avatar mikekay01 commented on July 16, 2024

OK, I got it!!!

from angular-leaflet-directive.

houqp avatar houqp commented on July 16, 2024

nice!
In short, avoiding using extend unless you think you really understand how scope works in angular ;p

from angular-leaflet-directive.

rvanbaalen avatar rvanbaalen commented on July 16, 2024

@houqp Why are you guys using angular.extend() in every example out there while you don't recommend it?

from angular-leaflet-directive.

houqp avatar houqp commented on July 16, 2024

Hm.. good point. I think It's because extend is handy for quick scope initialization. It does causes confusion for new angular users when they use it for scope update. But It's not a bad practice to use it. Once a user has a basic understanding of angular scope, he/she will be able to understand what is happening behind the scene :)

from angular-leaflet-directive.

timur-gilauri avatar timur-gilauri commented on July 16, 2024

@mikekay01 , can you please tell me how did you solve that problem. Beacause if i try to add markers in the way you did, not via function but in the beginning, leaflet doesnt add them. they ARE in map, but not displayed

from angular-leaflet-directive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.