【问题标题】:how to call angular 1.5 component on button click如何在按钮单击时调用 Angular 1.5 组件
【发布时间】:2016-09-16 12:25:21
【问题描述】:

由于我是 Typescript 的新手,我无法回答如何在单击按钮时调用我的角度组件“summaryReport”,这是我的演示代码。假设我有一个按钮必须在 openPdf 上调用我的组件() 点击,

<md-button ng-click="$ctrl.openPdf()">Summary Report</md-button>

My Component code is,

namespace mitchell.audit.estimate {
export class SummaryReportComponent {
    static ngComponentName = 'summaryReport';
}
angular.module(ngModuleName)
    .component(SummaryReportComponent.ngComponentName, {
        bindings: {
            estimateId: '@',
        },
        templateUrl: 'src/app/estimate/pdfReport/pdfSummary-report.component.html',
        controller: PdfSummaryReportController
    });

} 我想调用我的组件模板,

<summary-report flex layout="column" estimate-id="$ctrl.estimateId" style="display:none;"></summary-report>

我还尝试通过将“”放入 HTML 文件中来调用此组件模板,该文件将在单击按钮时加载,但这也不起作用。请帮助我找到在按钮单击时单击组件模板的正确方法或解决方案。 谢谢玛尼莎

【问题讨论】:

  • 谁能回复一下
  • 我不明白为什么没有专家回答

标签: javascript jquery angularjs


【解决方案1】:

你可以使用 $compile 来加载你的组件

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-06-01
    • 2019-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-05
    • 1970-01-01
    相关资源
    最近更新 更多