This package can be used with AngularJS version v1.6
and above.
import angular from 'angular';
import {Item, Route, potion} from 'potion-client/angularjs';
angular.module('myApp', [potion.name])
.factory('Foo', ['potion', (potion) => {
// Remeber that resources can also be registered using `@potion.registerAs('/foo')`
class Foo extends Item {
static bars = Route.GET('/bar');
name: string;
bar = Route.GET('/bar');
}
// If the `@potion.registerAs('/foo')` decorator is used,
// the below is not needed.
return potion.register('/foo', Foo);
}]);
import angular from 'angular';
import {potion} from 'potion-client/angularjs';
angular.module('myApp', [potion.name])
.controller('MyAppController', ['Foo', (Foo) => {
const foo = Foo.fetch(1);
}]);
import angular from 'angular';
import {potion} from 'potion-client/angularjs';
angular.module('myApp', [potion.name])
.config(['potionProvider', (potionProvider) => {
potionProvider.config({prefix: ''});
}]);