Cannot read property “loadListing” of Undefined -Karma Jasmine

拟墨画扇 提交于 2019-12-13 21:11:46

问题


This is my test case for checking whether the function is defined or not in the controller

Function:

  $scope.loadData = ()=> {

    LoadService.loadListing().then(function (responseData) {
             alert("Success");
            }

Test Case:

it('should have loadMeetings function', function () {
        expect(angular.isFunction(scope.loadData )).toBe(true);
    });

The Error : TypeError: Cannot read property 'loadListing' of undefined at Scope.MyCtrl.$scope.loadData

来源:https://stackoverflow.com/questions/27740395/cannot-read-property-loadlisting-of-undefined-karma-jasmine

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