Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict cheat sheet to controllers #53

Closed
hahmed opened this issue Jul 17, 2014 · 5 comments
Closed

Restrict cheat sheet to controllers #53

hahmed opened this issue Jul 17, 2014 · 5 comments
Labels

Comments

@hahmed
Copy link

hahmed commented Jul 17, 2014

Is there a way to restrict the displaying of the cheat sheet to only opted in controllers?

My angular app is defined as:

var myApp = angular.module('myApp', ['cfp.hotkeys']);

Because of this, where ever I have an angular controller the cheat sheet can be show.

Here is a controller where I want the cheat sheet to show:

myApp.controller('myController1', ['$scope', '$http', 'hotkeys', 'databoostrapped', function ($scope, $http, hotkeys, databoostrapped) {

Here I do not want it to show:

myApp.controller('dashboardController', ['$scope', '$http', 'databoostrapped', function ($scope, $http, databoostrapped) {

I am assuming as I do not have hotkeys defined for this controller it should not appear?

I am new to angularjs so I am just trying to understand the logic.

If I create a new App I am sure that the cheat sheet will not appear...

@ofpiyush
Copy link
Contributor

You should be able to turn it off on one controller by including hotkeys service and turning
hotkeys.includeCheatSheet = false;
But there is a spelling error in the code which makes this impossible. I'll send a pull request soon for the spelling error and a few other things.

But yeah, it remains on unless you explicitly turn it off.

I guess removing the register at app.run might help? (Not sure) (around line 545)

@bunkat
Copy link

bunkat commented Jul 27, 2014

As an aside, I had to remove the app.run call because it is not compatible with manually bootstrapping AngularJS applications.

@chieffancypants
Copy link
Owner

@bunkat does it error when manually bootstrapping, or the run block just doesn't run?

@bunkat
Copy link

bunkat commented Jul 28, 2014

It errors:

Uncaught Error: [$injector:unpr] http://errors.angularjs.org/1.2.16/$injector/unpr?p0=%24rootElementProvider%20%3C-%20%24rootElement%20%3C-%20hotkeys 

I'm using https://github.com/philippd/angular-deferred-bootstrap to bootstrap my app and so modules don't get loaded until after the bootstrap process is complete.

@chieffancypants
Copy link
Owner

Ah, well that's a bummer. I'll close this ticket since I merged @ofpiyush's PR, and open a new one for manually bootstrapped usage. Thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants