angularjs – ngClick在Angular 1.5.5组件中未触发的事件

前端之家收集整理的这篇文章主要介绍了angularjs – ngClick在Angular 1.5.5组件中未触发的事件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
为什么不单击下面模板中描述的按钮按预期工作? This blog post does the exact same thing.

'use strict';

angular.module('core').component('foo',{
    bindings: {
        items: '<',},controller: function() {
        function fire() {
            console.log('hello');
        }
    },template: "<button type='button' ng-click='$ctrl.fire();'>Test</button>"
});

编辑:为问题添加了更多清晰度

解决方法

功能触发器未暴露在控制器上.

this.fire = fire;

猜你在找的Angularjs相关文章