Skip to content

Navbar as Directive #457

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

Closed
kingcody opened this issue Aug 17, 2014 · 7 comments
Closed

Navbar as Directive #457

kingcody opened this issue Aug 17, 2014 · 7 comments

Comments

@kingcody
Copy link
Member

Just wondering if anyone else has considered this?

I normally implement it as a directive and it seems to be fairly beneficial. Allows for easier includes and more control over its setup.

@remicastaing
Copy link
Contributor

In the same vain, having "sign in" and "sign up" directives could be useful to easily move this forms in another place (for instance, on the landing page).

@kingcody
Copy link
Member Author

Or in a modal :)

@kingcody
Copy link
Member Author

For anyone interested, I have a generated project in a test repo that contains an opinionated 'angular-fullstack navbar'.

Opinions:

  • move as much manipulation logic out of the controller as possible
  • store navbar data in a service so it can be accessed by other controllers, services, etc...
  • use the controllerAs syntax
  • bind Auth to the $scope, not the Controller(this)

Also, I took a first attempt at writing test. I included a spec for the controller, service, and directive. Being those are my first 'test' with karma or jasmine, I wouldn't mind if someone pointed out any mistakes or shortcomings.

@remicastaing
Copy link
Contributor

How can I get rid of all this request:

...
GET /socket.io/?EIO=2&transport=polling&t=1408307307222-6517 200 6ms
...

It's polluting the console.

@remicastaing
Copy link
Contributor

Weird. They are gone.

@kingcody
Copy link
Member Author

It's from restarting the server and not doing a fresh reload on the client side.

A 'force reload' in the browser always fixes it for me.

@kingcody
Copy link
Member Author

More specifically, it's because the socket.io endpoint has been changed and you client was 'polling' the old endpoint. Which would now simply default to serving the main index.html; hence all the the short 200 responses.

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

No branches or pull requests

4 participants