All the docs related files (docs-app, doc-gen, content, etc) are now to be found inside the `/aio` folder. The related gulp tasks have been moved from the top level gulp file to a new one inside the `/aio` folder. The structure of the `/aio` folder now looks like: ``` /aio/ build/ # gulp tasks content/ #MARKDOWN FILES for devguides, cheatsheet, etc devguides/ cheatsheets/ transforms/ #dgeni packages, templates, etc src/ app/ assets/ content/ #HTML + JSON build artifacts produced by dgeni from /aio/content. #This dir is .gitignored-ed e2e/ #protractor tests for the doc viewer app node_modules/ #dependencies for both the doc viewer builds and the dgeni stuff #This dir is .gitignored-ed gulpfile.js #Tasks for generating docs and building & deploying the doc viewer ``` Closes #14361
1.7 KiB
@cheatsheetSection
Class decorators
@cheatsheetIndex 5
@description
{@target ts}import { Directive, ... } from '@angular/core';
{@endtarget}
{@target js}Available from the ng.core
namespace{@endtarget}
@cheatsheetItem
syntax(ts):
@Component({...}) class MyComponent() {}
|@Component({...})
syntax(js):
var MyComponent = ng.core.Component({...}).Class({...})
|ng.core.Component({...})
description:
Declares that a class is a component and provides metadata about the component.
@cheatsheetItem
syntax(ts):
@Directive({...}) class MyDirective() {}
|@Directive({...})
syntax(js):
var MyDirective = ng.core.Directive({...}).Class({...})
|ng.core.Directive({...})
description:
Declares that a class is a directive and provides metadata about the directive.
@cheatsheetItem
syntax(ts):
@Pipe({...}) class MyPipe() {}
|@Pipe({...})
syntax(js):
var MyPipe = ng.core.Pipe({...}).Class({...})
|ng.core.Pipe({...})
description:
Declares that a class is a pipe and provides metadata about the pipe.
@cheatsheetItem
syntax(ts):
@Injectable() class MyService() {}
|@Injectable()
syntax(js):
var OtherService = ng.core.Class( {constructor: function() { }}); var MyService = ng.core.Class( {constructor: [OtherService, function(otherService) { }]});
|var MyService = ng.core.Class({constructor: [OtherService, function(otherService) { }]});
description:
{@target ts}Declares that a class has dependencies that should be injected into the constructor when the dependency injector is creating an instance of this class.
{@endtarget}
{@target js}
Declares a service to inject into a class by providing an array with the services, with the final item being the function to receive the injected services.
{@endtarget}