Created
September 8, 2016 13:56
-
-
Save sparrow/f2c726c0d55015fd61567f6bb42bb76c to your computer and use it in GitHub Desktop.
This is an AngularJS code snippet that we used for our blog post https://rubygarage.org/blog/react-vs-angularjs at RubyGarage. It demonstrates how we inject dependencies in an Angular module. This code snippet was taken from a well-known TodoMVC application.
This file contains 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
angular.module('todomvc') | |
// Angular injects four dependencies in the TodoCtrl function – $scope, $routeParams, $filter, and store; | |
.controller('TodoCtrl', function TodoCtrl($scope, $routeParams, $filter, store) { | |
'use strict'; | |
var todos = $scope.todos = store.todos; | |
$scope.newTodo = ''; | |
$scope.editedTodo = null; | |
// missing function code is omitted for brevity | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment