Skip to content

Instantly share code, notes, and snippets.

@Sebmaster
Created April 25, 2013 07:10
Show Gist options
  • Save Sebmaster/5458039 to your computer and use it in GitHub Desktop.
Save Sebmaster/5458039 to your computer and use it in GitHub Desktop.
Integrate racer.js into an angular application
angular.module('MyApp', ['racer.js']).
config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
//$locationProvider.html5Mode(true);
$routeProvider.
when('/', { templateUrl: 'partials/home.htm', controller: IndexCtrl, resolve: IndexCtrl.resolve })
otherwise({redirectTo: '/'});
}]);
function Ctrl($scope, model) {
// model is exactly a racerjs model. See http://derbyjs.com/#model_features for details.
}
Ctrl.resolve = {
model: function (racer) {
return racer;
}
};
Ctrl.resolve.model.$inject = ['racer'];
Ctrl.$inject = ['$scope', 'model'];
@kristianmandrup
Copy link

I have been looking all evening for how to integrate AngularJS with Racer. Does this approach really work and is sufficient?

I have been looking here: https://groups.google.com/forum/#!msg/derbyjs/xBdQkzRAFzY/-NKryjwqGwAJ
and here: http://blog.dotcloud.com/tag/racer-js and submitted an issue requesting for this feature here:
derbyjs/racer#125

Would be awesome if you could help me create an angular module to make this a full integration for angular. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment