在变量ionic3中分配HTML内容

时间:2018-12-29 22:10:08

标签: angular typescript ionic3

我正在尝试在变量中分配组件的html内容,但是它给出了错误。

import { Component, ViewChild, ElementRef } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import * as jsPDF from 'jspdf';
import Relatorio1Page from './relatorio1';

/**
 * Generated class for the RelatoriosPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
    selector: 'page-relatorios',
    templateUrl: 'relatorios.html',
})

export class RelatoriosPage {

    constructor(public navCtrl: NavController, public navParams: NavParams) {

    }

    ionViewDidLoad() {
        console.log('ionViewDidLoad RelatoriosPage');
    }

    @aViewChild('conteudo') conteudo: ElementRef;
    public relatorio1(){
        //the objective is to fill this variable with relatorio1Page inner html
        let conteudo = Relatorio1Page.innerHTML; 
    }

}

页面之间的层次结构是

页 -relatorio1 --Relatorio1Page.ts -relatorios --RelatoriosPage.ts

你能帮我吗?

1 个答案:

答案 0 :(得分:0)

对不起,但是您不能将该页面用作组件吗?