accessing $scope from unit test file when using the vm “ControllerAs” syntax from AngularJS HotTowel

后端 未结 2 1566
栀梦
栀梦 2020-12-28 13:44

See here for example: http://www.johnpapa.net/angularjss-controller-as-and-the-vm-variable/

As the title suggests, I\'m following along on this tutorial [http://tech

2条回答
  •  情深已故
    2020-12-28 14:05

    you can also do this:

    it("should assign Dashboard as title", function () {
        var controller = controller("dashboard as vm", { $scope: scope });
    
        expect(scope.vm.title).toBe("Dashboard");
    });
    

提交回复
热议问题