Ng-mock: $compileProvider doesn't have method 'preAssignBindingsEnabled`

↘锁芯ラ 提交于 2020-01-04 02:27:08

问题


I've been rewriting directives in Angular 1.5.8 to components. I want to write unit tests with '$componentController` just like described here: https://docs.angularjs.org/guide/component.

The problem is that I'm getting error at this line:

var ctrl = $componentController('componentName', null, bindings);

saying: undefined is not a constructor (evaluating 'compileProvider.preAssignBindingsEnabled()') app/lib/angular-mocks/angular-mocks.js:2235:80

So it looks like $compileProvider doesn't have preAssignBindingsEnabled method at all. If anyone has an idea of what possibly I'm doing wrong I'd appreciate a little help.

Thanks!

UPDATE: jsFiddle of unit test: https://jsfiddle.net/kveb1ovo/2/

来源:https://stackoverflow.com/questions/41891330/ng-mock-compileprovider-doesnt-have-method-preassignbindingsenabled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!