angular/aio/content/examples/upgrade-module/src/app/hero-detail.directive.ts
Georgios Kalpakas b836aca999 docs(aio): rework of the upgrade guide
This commit was worked on by a number of people including
@filipesilva, @gkalpak and @wardbell. It contains changes that:

* remove unused files,
* fix the bootstrap approach to ensure that bootstrap is in the correct Zone
* fix unclosed code-example tags
* replace use of "we" with "you"
* remove broken dual router example

Related to angular/angular.io#3541
2017-05-19 09:42:17 +01:00

23 lines
494 B
TypeScript

// #docregion
export function heroDetailDirective() {
return {
restrict: 'E',
scope: {},
bindToController: {
hero: '=',
deleted: '&'
},
template: `
<h2>{{$ctrl.hero.name}} details!</h2>
<div><label>id: </label>{{$ctrl.hero.id}}</div>
<button ng-click="$ctrl.onDelete()">Delete</button>
`,
controller: function() {
this.onDelete = () => {
this.deleted({hero: this.hero});
};
},
controllerAs: '$ctrl'
};
}