angle2モジュールをangle2を使用しない別のWebアプリケーションにインポートするには、webcomponentsとHTML importを使用します。私は、HTMLのインポートはいくつかのブラウザでネイティブにしかサポートされていないことを知っていますが、私はポリマーフレームワークを使用して他のブラウザに影響を与えます。HTML import angular2 appとpassパラメータ
角度アプリをインポートできますが、角度アプリをインポートするウェブアプリから角度アプリにパラメータを渡すことができません。私はこれをしようとしている:
<dom-module id="sale-stats">
<link rel="import" href="../bower_components/polymer/polymer.html">
<template>
<!-- contains my angular app bundled js files -->
<link rel="import" href="imports.html">
{{saleid}} <!-- this displays the saleid just to see that the parameter is passed to the webcomponent -->
<app-root saleid='{{saleid}}'>Loading... </app-root>
</template>
<script>
HTMLImports.whenReady(function() {
Polymer({
is: 'sale-stats',
properties: {
saleid: {
type: String,
value: '0'
}
},
});
});
</script>
</dom-module>
<script src="/Scripts/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="http://localhost:9600/salestats/index.html" />
<sale-stats saleid="1234567"></sale-stats>
別のアプリケーションにインポートされwebcomponentとして角度アプリを使用する際にどのように私は私の角のアプリにパラメータを渡すのですか?または、Webコンポーネントとして角型アプリケーションをインポートしようとするのはまったく間違っていますか?
Polymerの代わりにwebcomponents.jsまたは単にhtmlimports.jsを使用してください。 – Supersharp
角度アプリをインポートしているアプリでwebcomponents.jsを使用しています。ちょうどコードでスクリプトを追加しました。しかし、Webコンポーネントをネイティブにサポートしていないブラウザをサポートするためには、角型アプリでPolymerが必要です。 – Poku
Webcomponents.js *はPolymerがさまざまなブラウザをサポートするために使用するpolyfillです – Supersharp