JSFiddle - React, Tailwind, and code Playground

by RajamohanShilpa A

HTML

<script src="//code.angularjs.org/1.4.8/angular-route.js"></script>
<script src="https://code.angularjs.org/1.4.8/angular-mocks.js"></script>
<span ng-controller="sampleCtrl1">
  {{testObj}}
  {{result}}
  <test-dir>  
   {{ngTest}}
  </test-dir>
</span>

CoffeeScript

do()->
 angular.module 'sampleApp.Controller',[]
 angular.module 'sampleApp.Service',['ngMockE2E']
 app = angular.module 'sampleApp',['sampleApp.Controller','sampleApp.Service']     
 app.run ($httpBackend)->
  phones = [
     {
       id: 'CC001'
       name: 'phone1'
       brand: 'SONY'
       price: 20000
     } 
     {
       id: 'CC002'
       name: 'phone2'
       brand: 'SONY'
       price: 22000
     }
     {
       id: 'CC003'
       name: 'phone3'
       brand: 'SONY'
       price: 25000
     }]
     
  $httpBackend.whenGET('/phone').respond (method,url,data)->
    console.log "Getting phones"
    return[
    	200
      phones
      {}]
      
  $httpBackend.whenPOST('/phone').respond (method,url,data,headers)->
    console.log 'Received these data:', method, url, data, headers  
    phones.push angular.fromJson data
    return[
    	200
      phones
      {}]
  return
  
 angular.module('sampleApp.Controller').controller 'sampleCtrl1',($scope,$http)-> 	
  $scope.testObj = "Test Module"  
  $http.get('/phone').then (response)->
   $scope.result = response.data
   return
  return
 app.directive "testDir",()->  
  return{
   restrict:'AE'
   link: (scope,attr,ctrl)->    
    scope.ngTest = "Test from directive";
    return
  }
 angular.bootstrap document, ['sampleApp']
 return