JSFiddle - React, Tailwind, and code Playground

by msfrisbie

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0-rc.1/angular.js"></script>
<div ng-app="test" ng-init="binding='superluminal'">
  <div my-test="nudge" foo="binding" ></div>
</div>

JavaScript

angular.module('test',[])
.component('myTest', {
    restrict:'A',
    bindToController:true, //this is where the magic happens
    scope: {
      foo:'=',
      myTest:'@' 
      //works for all values in an isolate scope
    },
    controller:function() {  
      //available in the controller, to read and write
      this.foo = this.foo || 'default'
    },
    controllerAs:'ctrl',
    template:'<h2>Inside template</h2>{{ctrl.foo}} - {{ctrl.myTest}}'
    //no linking function or scope/$scope needed...
  } 
);