0

I am following https://angular.io/docs/ts/latest/guide/upgrade.html steps, namely "Using Angular 2 Components from Angular 1 Code" part.

Have created hero-detail.component.ts with following code:

import { Component } from '@angular/core';
@Component({
  selector: 'hero-detail',
  template: `
    <h2>Windstorm details!</h2>
    <div><label>id: </label>1</div>
  `
})
export class HeroDetailComponent {
}

Then added required code to main.ts:

import { upgradeAdapter } from './upgrade-adapter'; //this existed already
import { HeroDetailComponent } from './hero-detail.component'; //added

//... here other code inbetween

angular.module('heroApp', [])
  .directive('heroDetail', upgradeAdapter.downgradeNg2Component(HeroDetailComponent));

Now I insert <hero-detail></hero-detail> in my html, but see nothing. What is missing?

1 Answer 1

0

Directive part of code should have been added to app.ts, not main.ts.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.