Example directive object:

angular.module('app').directive('myDirective', myDirective);

function myDirective() {
    return {
        restrict: 'A',
        scope: { someInt: '=' },
        templateUrl: 'some/url/for/template.html',
        controller: function ($scope) {
            this.addOne = function () {
                this.someInt += 1;
            };
        },
        controllerAs: 'vm',
        bindToController: true
    };
}

How would I go about testing the addOne() method on that directive's 
controller. I've searched absolutely everything and none of the articles 
I've found have helped. I start with this and then don't know how to get to 
the controller to access that method:

$compile('<div my-directive></div>')($scope);

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to