AngularJS Link function not called

前端 未结 4 1151
一整个雨季
一整个雨季 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

    It is not your case, but the same issue might occur when the naming of your directive is not correct. Be especially careful to dashes in the name. Since angular automagically transforms between them, it's a very very common mistake.

    consider this template

    with this directives.

     angular
       .module('biApp')
       .directive('this-wont-work', () => ( { link: () => console.log('nope')} ))
       .directive('thisWillWork', () => ( { link: () => console.log('works')} ))
    

提交回复
热议问题