angular-class
An Angular service for creating classes with inheritance. Exposes the Class
service.
API
Class
The Class service.
Class.extend(classDefenition)
Defines a new Class.
classDefenition.init
The contructor method
classDefinition.*
Other class methods
Inside any class method
this
The instance.
this._super
The current method on the first ancestor which has this method.
this.*
Any class method or property.
Example usage
The functionality of the Class
service is best explained by some examples.
//Creates the 'MyModels' module, which requires the 'Class' moduleangular//The Animal ModelClass, uses the 'Class' service//The Hamster ModelClass, uses the 'Animal' ModelClass service;// A controller, which uses both the ModelClassesmyApp;
Installation
bower install angular-class --save
ornpm install angular-class --save
- Include reference to
angular-class.min.js
- Add the
Class
module as dependency.
Running the tests
- Get the source code.
npm install
bower install
gulp test
Credits
- Original author: John Resig. See the original blog post.
- This Angular wrapper package: Mark Lagendijk