Skip to content

Instantly share code, notes, and snippets.

@BernhardPosselt
Last active December 11, 2015 11:39
Show Gist options
  • Save BernhardPosselt/4595335 to your computer and use it in GitHub Desktop.
Save BernhardPosselt/4595335 to your computer and use it in GitHub Desktop.
Pimple vs AngularJS dependency injection
<?php
// PHP pimple
$container = new Pimple();
$container['ActiveFeed'] = $container->share(function($c){
return new MyActiveFeed($c['MyModel'], $c['TestService']);
});
// angularjs
angular.module('News').factory 'ActiveFeed', ['MyModel', 'TestService', (MyModel, TestService)->
return new MyActiveFeed(MyModel, TestService)
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment