Question from the AngularJS test

AngularJS: How to use $controller in a controller

Expert

Given the following module and controller:

angular
   .module('app', [])
   .conroller('appController', function () {
      this.greeting = 'hello';
   });

And its associated unit test:

describe('app', function () {
   beforeEach(module('app'));

   describe('appController', function () {
      beforeEach(inject(function () {
         appController = $controller('appController');
      }));
      
      it('should greet us', function () {
         expect(appController.greeting).toBe("hello");
      });
   });
});

What will happen?

Author: Mathieu RobinStatus: PublishedQuestion passed 93 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!