简体   繁体   English

在新组件中调用angular 1.5中的函数

[英]Calling a function in angular 1.5 as a new component opens

I have a component where on click of a button i am calling another component. 我有一个组件,单击按钮后我会调用另一个组件。

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();
            }            
        }

Now I want to call a function int that abc-xyz component as soon as it opens. 现在,我想在打开后立即调用该abc-xyz组件的函数int。

the js of the component is: 该组件的js是:

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

As soon as I click the button in the first component it should call this xyz function, but I am unable to call it. 当我单击第一个组件中的按钮时,它应该调用此xyz函数,但是我无法调用它。 Could somebody help me with this? 有人可以帮我吗?

Invoke the function using xyz(); 使用xyz()调用该函数; in the abc-xyz component's controller below the definition of xyz() function. 在xyz()函数定义下方的abc-xyz组件的控制器中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM