Created
April 25, 2013 07:10
-
-
Save Sebmaster/5458039 to your computer and use it in GitHub Desktop.
Integrate racer.js into an angular application
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
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']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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!