JSFiddle - React, Tailwind, and code Playground

by charliedavi

HTML

<div ng-app="WhereToMeet" ng-controller="MapCtrl">
    <leaflet shape="shape"></leaflet>
    <button ng-click="clicked()">Clicked</button>
</div>

JavaScript

app = angular.module("WhereToMeet", [])

app.directive "leaflet",  ->
    restrict: "E"
    replace: true
    transclude: true
    template: "<div id=\"map\"></div>"
    scope:
      shape: "=shape"
    link: (scope, element, attrs, ctrl) ->
     
     scope.$watch attrs.shape,( (newValue, oldValue) ->
        watched newValue
      ), true
     
     watched = (newValue) ->
         alert newValue
         
                
MapCtrl = ($scope) - >
    clicked = (clicked) ->
        $scope.shape = "Clicked"
        alert "clicked"