Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- angular.module('myApp');
- angular.module('myApp', ['ngCookies']);
- <body>
- <form ng-submit="callSignIn(username, password, site)">
- Email:
- <input type="text" ng-model="username"><br>
- Password:
- <input type="text" ng-model="password"><br>
- Site:
- <input type="text" ng-model="site"><br>
- <input type="submit" value= "Submit">
- </form>
- <section ui-view>Response: {{response}}</section>
- </body>
- 'use strict';
- (function(){
- class LoginComponent {
- constructor($scope, $http) {
- $scope.callSignIn = function(username, password, site) {
- $http.post('/api/auth/signin', {
- username: username,
- password: password,
- site: site
- }).success(function(response) {
- $scope.response = response;
- });
- };
- }
- }
- angular.module('orbitApp')
- .component('login', {
- templateUrl: 'app/login/login.html',
- controller: LoginComponent
- });
- })();
- 'use strict';
- angular.module('orbitApp')
- .config(function ($stateProvider) {
- $stateProvider
- .state('login', {
- url: '/login',
- template: '<login></login>'
- });
- });
- {"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