-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(view-locator): allow associating views with classes
This enables any class to have one or more associated views. With a view associated, the au-compose element can then render instances of the class by using the view value converter.
- Loading branch information
1 parent
c65ccf0
commit 9a89686
Showing
4 changed files
with
174 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { IViewLocator } from '../../templating/view'; | ||
import { valueConverter } from '../value-converter'; | ||
|
||
@valueConverter('view') | ||
export class ViewValueConverter { | ||
constructor(@IViewLocator private viewLocator: IViewLocator) {} | ||
|
||
public toView(subject: object, viewName?: string) { | ||
return this.viewLocator.getViewComponentForModelInstance( | ||
subject, | ||
viewName | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters