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

Wrong code sample of $componentController in component guide #14091

Closed
ptgamr opened this issue Feb 20, 2016 · 2 comments
Closed

Wrong code sample of $componentController in component guide #14091

ptgamr opened this issue Feb 20, 2016 · 2 comments
Milestone

Comments

@ptgamr
Copy link
Contributor

ptgamr commented Feb 20, 2016

The guide at https://docs.angularjs.org/guide/component

It has an error (bellow)

describe('component: heroDetail', function() {
  var component, scope, hero;
    ....

  beforeEach(inject(function($rootScope, $componentController) {
    scope = $rootScope.$new();
    hero = {name: 'Wolverine'};
  }));

  it('should set the default values of the hero', function() {

    // $componentController is `undefined` here
    component = $componentController('heroDetail', {$scope: scope});

   ...
  }
}
@ptgamr ptgamr changed the title Can't use $componentController in tests Wrong code sample of $componentController in component guide Feb 20, 2016
@gkalpak
Copy link
Member

gkalpak commented Feb 20, 2016

Indeed. PRs welcome 😃

@ptgamr
Copy link
Contributor Author

ptgamr commented Feb 20, 2016

@gkalpak here you go

ptgamr added a commit to ptgamr/angular.js that referenced this issue Feb 21, 2016
@petebacondarwin petebacondarwin added this to the 1.5.1 milestone Feb 21, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants