Development Tip: AngularJS Service, Factory, Directive, and More in Appery.io
AngularJS provides a powerful and convenient way to organise your code via services, factories, directives and more. Here, at Appery.io, we call them AngularJS resources
. As usual, in best traditions of Appery.io, we’re making complex stuff easier. So, to create a preferred resource perform, CREATE NEW > JavaScript
. Then choose what type of resource you want to create by selecting the needed option from the type
drop-down. When clicking “Create JavaScript”, new custom JavaScript will be added to your project with a ready-to-use template of the chosen resource. Inserting a few useful comments in each template will help you to start coding quickly. Afterwards, you can simply use the created resource in scope functions by calling it the Apperyio.get()
function:
var my_service = Apperyio.get("service_name");
Yeah, that’s easy.
Read more about resource in documentation and make sure to check out all of our mobile development tips.