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

Changing the action of submitLogin #86

Closed
c0mrade opened this issue Jan 2, 2015 · 3 comments
Closed

Changing the action of submitLogin #86

c0mrade opened this issue Jan 2, 2015 · 3 comments

Comments

@c0mrade
Copy link

c0mrade commented Jan 2, 2015

I use angular (and this gem) with rails.

If I have form like this :
<form ng-submit="submitLogin(loginForm)" role="form" ng-init="loginForm = {}">

And it's always hitting my route :
/api/auth/sign_in

However my api path is :
/api/v3/auth/sign_in

How do I change this to hit the right route?

@c0mrade c0mrade changed the title Changing the action of submitForm Changing the action of submitLogin Jan 2, 2015
@lynndylanhurley
Copy link
Owner

@c0mrade - have you read the configuration section of the readme?

If all of your routes start with /api/v3, I would recommend changing the apiUrl param to /api/v3.

Example:
angular.module('myApp', ['ng-token-auth'])
  .config(function($authProvider) {
    $authProvider.configure({
      apiUrl: '/api/v3'
    })
  })

@c0mrade
Copy link
Author

c0mrade commented Jan 2, 2015

sweet thanks. Yes I have read it but I wasn't sure what was right thing to do. I'm new to angular. I had this suggestion before :

<form action="{{ ContextUrl + '/api/v1/auth/sign_in' }}">

Didn't like it. Your answer is much better. thanks again

@lynndylanhurley
Copy link
Owner

Cool, just re-open this issue if for some reason that doesn't work.

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

No branches or pull requests

2 participants