03. Architecture overview - Metadata
Architecture overview - Metadata
Angular වලදී භාවිතා වනMetadata,Typescript class decorate කරන්න භාවිතා කරන අතර මෙම
Metadata හරහා class
එකක behaviour එක කොහොමද කියලා configure
කරන්න
පුළුවන්.
TypeScript
class – without metadata
TypeScript class – with metadata
මෙහිදී @Component මගින් Department class එක components ක් බව angular වෙත කියන අතර ''selector","templateUrl" වැනි decorators හරහා class එකේ behaviour එක configure කර ඇත.නමුත්
මෙම Metadata
එක භාවිතා කරන
තුරු එය component එකක් බව angular
නොදනී.( @Component is a decorator that gives the Deparment
class more functionality using the metadata (selector, templateURL) associated
with it).
A decorator
is a function that has a configuration object.
Typescript class has metadata attach to it. It contain information that angular needs to decide whether particular class infects to angular module or it is just a regular class. Meta data is defining using decorator which is a feature in typescript. It is just a function that provides information about the class which attach to it. Within the Component, we use component decorator.
Comments
Post a Comment