johnpapa / generator-hottowel

Yo generator that creates an Angular app via HotTowel
835 stars 230 forks source link

htSidebar uses bindToController, but no controller #97

Closed rkoberg closed 7 years ago

rkoberg commented 9 years ago

This is producing an error with anguilar 1.4.x:

Error: [app Error] [$compile:noctrl] Cannot bind to controller without directive 'htSidebar's controller. http://errors.angularjs.org/1.4.1/$compile/noctrl?p0=htSidebar

Frozair commented 9 years ago

I am also on 1.4.x and having the same issue. In the comments for the directive it mentions the use of vm.sidebarReady(), but i cannot find anywhere where this method is defined. Is there a controller missing for htSidebar directive?

Thanks

robarchibald commented 9 years ago

Simply update the ht-sidebar.directive.js to include the two additional attributes now required... the controller and controllerAs. This worked for me

   var directive = {
        bindToController: true,
        controller: 'SidebarController',
        controllerAs: 'vm',
johnpapa commented 9 years ago

@robarchibald that directive is not using that controller, so it shouldnt do that. The bindToController can simply be removed since the directive has none.

BTW ng 1.4 allows bindToController to be set to an object literal and then move all scope props to it, just keeping an empty scope object.

I'll look at the test when I get a moment, or maybe @WardBell may have a moment.

johnpapa commented 9 years ago

0.3.4 removes the controller