Skip to content

Listing directives in @View is verbose (especially for common / easy cases) #1293

@pkozlowski-opensource

Description

@pkozlowski-opensource

As of today one needs to enumerate all the directives used by a given @View. This is very verbose and repetitive process, especially for simpler cases / components where one uses only standard / built-in directives.

Assuming that I'm building a simple components that only consumes built-in directives I need to write:

import {Component, Template, bootstrap} from 'angular2/angular2';
import {If} from 'angular2/angular2';

@Component({
....
})
@View({
  inline: '...',
  directives: [If]
})
class Simple {
...
}

In a nutshell it means that for every directive I need to:

  • import it
  • reference in directives

While I understand the benefits of this approach as well as technical limitations here, it is still very repetitive in practice, especially for very often (application-wide) directives (built-ins, directives used in most of the pages, etc.).

Here are few ideas of how to make it easier on people:

  • allow omit directives and assume that all built-in directives are available
  • allow omit directives and assume that all directives specified by an app developer are available

This is not urgent / critical piece but would make things significantly easier on people.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions