AngularJS Circular Dependency Fix
|Release Date||Jun 7, 2017|
We have changed the structure of the Angular SDK to break cyclic dependencies. Due to this, the following changes have been made:
- Model deserialization logic has moved out from model files.
- We have added new files
ModelFactory.jsto the SDK.
BaseModelis now being used to assign values to model properties (when model class is directly instantiated)
BaseControllerhas been added to the SDK.
Please generate your SDK again to get the improved code.
- Previously, models were being imported in other model files because model deserialization was done inside the model files. This caused cyclic dependencies in some cases. To break this cyclic dependency, we have changed the structure of model classes and added
ModelFactoryfiles alongwith changes to
BaseModelfiles as well as addition of
ObjectMapperservice is now being used for mapping the model fields with their appropriate values.
- Model instantiation has now moved to
ModelFactory.jsservice. Previously, controllers directly instantiated models.
- Previously, properties of a model object were deserialized (or mapped with their corresponding values) inside the model file itself. This behavior has changed now. Model files do not deserialize the object themselves. There are 2 cases: We still allow users to create instances of models and pass in an object. In this case, the correct value for a model field is gotten from the object (if it is defined). So the correct object needs to be passed in the constructor (with the right property names and values). However, if a model is instantiated using the model factory (as is done in the controllers now), then model deserialization will be handled by the
- We are now maintaining a mapping object in model files which contains information about the properties of the models/exceptions.
BaseModel.jshas been updated according to the mappingInfo addition in model files.
BaseControllerhas been added to the SDK now. BaseController returns an instance of the
Have questions? Submit a request.