【问题标题】:Assign html content in a variable ionic3在变量ionic3中分配html内容
【发布时间】:2019-05-27 04:13:05
【问题描述】:

我正在尝试在变量中分配组件的 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

你能帮帮我吗?

【问题讨论】:

  • 您的确切错误信息是什么?你什么时候打电话给relatorio1()?你试过访问Relatorio1Page.nativeElement.innerHTML吗?
  • 请也分享 html 文件。你的问题不清楚

标签: angular typescript ionic3


【解决方案1】:

抱歉,您不能将该页面用作组件?

【讨论】:

    猜你喜欢
    • 2018-01-04
    • 2018-07-29
    • 1970-01-01
    • 1970-01-01
    • 2016-10-15
    • 1970-01-01
    • 1970-01-01
    • 2018-03-16
    • 1970-01-01
    相关资源
    最近更新 更多