JSFiddle - React, Tailwind, and code Playground
by garmashnikolay
HTML
<div ng-app="asyncServiseTest" ng-controller="testController">
<h1>TEST!</h1>
<bind-to-servise></bind-to-servise>
</div>
CoffeeScript
app = angular.module "asyncServiseTest", []
app.directive "bindToServise", ["dataServise", (dataServise) ->
restrict: "E"
scope: {}
template: "<div>{{ test }}</div>"
link: (scope) ->
scope.test = dataServise.test
]
app.factory "asyncServise", ["dataServise", "$timeout", (dataServise, $timeout) ->
load: ->
$timeout ->
dataServise.test = "ASYNC DATA!"
, 1000
]
app.factory "dataServise", ->
test: "Init Data"
app.controller "testController", ["$scope", "asyncServise", ($scope, asyncServise) ->
asyncServise.load()
]