AngularJS Link function not called

前端 未结 4 1155
一整个雨季
一整个雨季 2021-01-04 04:18

I\'m trying to write my first AngularJS directive: one involving the link function. The directive is being loaded, but when I use it in my page the link<

4条回答
  •  爱一瞬间的悲伤
    2021-01-04 05:18

    Another reason this could happen for people is that there is a runtime error in one of the other compilation phases for the directive.

    ng.module(MODULE).directive('myDirective', [() => {
        return {
            link() {
                // Never getting here
            },
            template() {
                // Error here would mess things up
            },
            controller() {
                // error here would mess things up
            }
        };
    }]);
    

提交回复
热议问题