私たちはtypescriptを使用してng1と2を混合し、モジュールローダーを使用しないという独特の状況があります。私はng1とng2の両方をブートストラップすることができましたが、コードの中にブレークポイントを入れてコードが実行されるのを見たが、コンポーネントには何も表示されませんでした。角度1内でレンダリングされないダウングレードAngular2コンポーネント
コンパイル段階ではなく実行時ではなく、エラーは発生しません。角度1つのアプリの定義、es2015
(function() {
'use strict';
angular.module('myApp', []);
})();
myapp.ng2.ts - - 角度の2アプリの定義、typescriptです
namespace MyApp {
let NgModule = ng.core.NgModule;
let BrowserModule = ng.platformBrowser.BrowserModule;
let UpgradeAdapter = ng.upgrade.UpgradeAdapter;
@NgModule({
imports: [BrowserModule]
})
export class MyAppNg2 {}
export const upgradeAdapter = new UpgradeAdapter(MyAppNg2);
$(document).ready(function() {
upgradeAdapter.bootstrap(document.body, ['MyApp'], {strictDi: false});
});
}
myapp.js:ここ
コードですfullDetails.component.ts - 角度2 、typescriptです
namespace MyApp.Components.Misc {
let Component = ng.core.Component;
@Component({
selector: 'full-details-header',
template: `This is ng2 component`
})
export class FullDetailsHeaderComponent {
}
}
bootstrap.js - angular1、es2015
angular.module('myApp').component('fullDetailsHeader', MyApp.upgradeAdapter.downgradeNg2Component(MyApp.Components.Misc.FullDetailsHeaderComponent));
解決策は見つかりましたか? –