Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit e3982c9

Browse files
committed
fix(docs/guide/component): wrong $componentController usage
1 parent 2d6c218 commit e3982c9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/content/guide/component.ngdoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,18 +420,19 @@ The examples use the [Jasmine](http://jasmine.github.io/) testing framework.
420420
**Controller Test:**
421421
```js
422422
describe('component: heroDetail', function() {
423-
var component, scope, hero;
423+
var component, scope, hero, componentController;
424424

425425
beforeEach(module('simpleComponent'));
426426

427427
beforeEach(inject(function($rootScope, $componentController) {
428428
scope = $rootScope.$new();
429+
componentController = $componentController;
429430
hero = {name: 'Wolverine'};
430431
}));
431432

432433
it('should set the default values of the hero', function() {
433434
// It's necessary to always pass the scope in the locals, so that the controller instance can be bound to it
434-
component = $componentController('heroDetail', {$scope: scope});
435+
component = componentController('heroDetail', {$scope: scope});
435436

436437
expect(component.hero).toEqual({
437438
name: undefined,
@@ -442,15 +443,15 @@ describe('component: heroDetail', function() {
442443
it('should assign the name bindings to the hero object', function() {
443444
// Here we are passing actual bindings to the component
444445

445-
component = $componentController('heroDetail',
446+
component = componentController('heroDetail',
446447
{$scope: scope},
447448
{hero: hero}
448449
);
449450
expect(component.hero.name).toBe('Wolverine');
450451
});
451452

452453
it('should call the onDelete binding when a hero is deleted', function() {
453-
component = $componentController('heroDetail',
454+
component = componentController('heroDetail',
454455
{$scope: scope},
455456
{hero: hero, onDelete: jasmine.createSpy('deleteSpy')}
456457
);

0 commit comments

Comments
 (0)