Last active
January 2, 2016 18:09
-
-
Save ajhekman/8342102 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create a module | |
# here we've created a module "myModule" that has a 3rd party dependency "toolkit" | |
# if we didn't have dependencies, then we would use a blank array "[]" | |
angular.module('myModule', ['toolkit']) | |
# file: /app/scripts/services/RemoteResource.coffee | |
# here we're referencing the already defined 'myModule', and defining the service | |
# "remoteResource" with a dependency of "$http"(AngularJS builtin) | |
angular.module('myModule').service 'RemoteResource', ($http)-> | |
retrieve: ()-> | |
$http.get "url" | |
# file: /app/scripts/controllers/myController1.coffee | |
# here we're referencing the already defined 'myModule', and defining the controller | |
# "myController1" with a dependencies "$scope"(AngularJS builtin) and "remoteResource" | |
angular.module('myModule').controller 'myController1', ($scope, RemoteResource) -> | |
$scope.resourceText = "" | |
RemoteResource.retrieve().then (response)-> | |
$scope.resourceText = response.data | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment