非常にうまく機能するこの素晴らしいAngular2 Seedを使用して、Angular 2 アプリケーションを作成しました。だから私が持っている質問は、この Angular 1 ディレクティブをどのようにアップグレードできるかということです:
import template from './sbgOutlineButton.html!text';
var app = angular.module('sbgOutlineButton', []);
app.directive('sbgOutlineButton', function() {
let link = function(scope, element, attributes) {
if (attributes.icon === undefined) {
let materialIcon = element.find('i.material-icons');
materialIcon.addClass('hidden');
}
};
return {
link: link,
restrict: 'E',
template: template,
replace: true,
transclude: true,
scope: { icon: '@' }
};
});
export default app;
次の Angular 2 コンポーネントで使用できるようにします。
import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { UpgradeAdapter } from '@angular/upgrade';
@Component({
moduleId: module.id,
selector: 'test-page',
templateUrl: 'testpage.page.html',
styleUrls: ['testpage.page.css']
})
export class TestPage implements OnInit {
constructor() { }
ngOnInit() { }
}
どうすればこれを達成できるかについて、何か考えがありますか?それは可能ですか?私の調査中に見つけた他の記事の多くは、「ベース」アプリケーションがAngular 1であるべきであることを示唆しているため...
前もって感謝します。フランソワ