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

fix(ngMock#$controller): properly assign bindings to all types of controllers (e.g. class-based) #14439

Commits on Apr 15, 2016

  1. fix(ngMock#$controller): properly assign bindings to all types of con…

    …trollers (e.g. class-based)
    
    The decorated version of `$controller` is able to assign bindings to a controller instance prior to
    instantiation, emulating the behavior of `$compile` with directive controllers.
    
    There are cases, that the actual controller instance is different than the pre-populated one (e.g.
    when the controller constructor function returns a value or when the controller is an ES2015 Class).
    While `$compile` accounts for such situation, by re-asigning the bindings after the controller has
    been instantiated, `ngMock`'s `$controller` didn't.
    
    This commit fixes it, by re-applying the bindings if the actual controller instance is different
    than the original one (similar to how `$compile` would do it).
    
    Fixes angular#14437
    gkalpak committed Apr 15, 2016
    Copy the full SHA
    974cad9 View commit details
    Browse the repository at this point in the history