Advertisement
Guest User

Untitled

a guest
Jun 6th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. angular.module('myApp');
  2.  
  3. angular.module('myApp', ['ngCookies']);
  4.  
  5. <body>
  6. <form ng-submit="callSignIn(username, password, site)">
  7. Email:
  8. <input type="text" ng-model="username"><br>
  9. Password:
  10. <input type="text" ng-model="password"><br>
  11. Site:
  12. <input type="text" ng-model="site"><br>
  13. <input type="submit" value= "Submit">
  14. </form>
  15. <section ui-view>Response: {{response}}</section>
  16. </body>
  17.  
  18. 'use strict';
  19. (function(){
  20.  
  21. class LoginComponent {
  22. constructor($scope, $http) {
  23. $scope.callSignIn = function(username, password, site) {
  24. $http.post('/api/auth/signin', {
  25. username: username,
  26. password: password,
  27. site: site
  28. }).success(function(response) {
  29. $scope.response = response;
  30. });
  31. };
  32.  
  33. }
  34. }
  35.  
  36. angular.module('orbitApp')
  37. .component('login', {
  38. templateUrl: 'app/login/login.html',
  39. controller: LoginComponent
  40. });
  41.  
  42. })();
  43.  
  44. 'use strict';
  45.  
  46. angular.module('orbitApp')
  47. .config(function ($stateProvider) {
  48. $stateProvider
  49. .state('login', {
  50. url: '/login',
  51. template: '<login></login>'
  52. });
  53. });
  54.  
  55. {"http_code":200,"response":{"authentication_token":"a","site_id":"b","content_url":"c","user_id":"d"}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement