【问题标题】:Calling a function in angular 1.5 as a new component opens在打开新组件时调用 angular 1.5 中的函数
【发布时间】:2018-02-25 11:26:53
【问题描述】:

我有一个组件,在单击按钮时我正在调用另一个组件。

model.alert = function () {
            modalInstance = $uibModal.open({
                template: '<abc-xyz return-value="model" on-cancel="Cancel()"></abc-xyz>',
                scope: modalScope,
                backdrop: 'static',
                windowClass: 'callrecord-popup'
            });

            modalScope.Cancel = function () {
                modalInstance.close();
            }            
        }

现在我想在 abc-xyz 组件打开后立即调用它。

组件的js是:

   function taxReconciliationAlertController($scope) {
            var model = this;
// Inside here i have written the function
function xyz(){
//some code here which returns data to html
}    
}

只要我单击第一个组件中的按钮,它就会调用这个 xyz 函数,但我无法调用它。有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: javascript angularjs components


    【解决方案1】:

    使用 xyz() 调用函数;在 abc-xyz 组件的控制器中 xyz() 函数的定义下方。

    【讨论】:

      猜你喜欢
      • 2017-12-18
      • 1970-01-01
      • 2016-11-02
      • 1970-01-01
      • 2016-08-21
      • 1970-01-01
      • 2017-07-27
      • 2016-02-23
      • 2016-09-04
      相关资源
      最近更新 更多