Moved back to ng1
Change-Id: I43b284e3b3cb3ac19d43c088de988c89a7ea8807
diff --git a/src/app/core/login/login.html b/src/app/core/login/login.html
new file mode 100644
index 0000000..f4a0724
--- /dev/null
+++ b/src/app/core/login/login.html
@@ -0,0 +1,5 @@
+<form name="login">
+ <input type="text" name="username" ng-model="username" required>
+ <input type="text" name="password" ng-model="password" required>
+ <button type="button" ng-click="vm.login(username, password)">Login</button>
+</form>
diff --git a/src/app/core/login/login.ts b/src/app/core/login/login.ts
new file mode 100644
index 0000000..af46619
--- /dev/null
+++ b/src/app/core/login/login.ts
@@ -0,0 +1,30 @@
+import {AuthService} from '../../rest/auth.rest';
+
+class LoginCtrl {
+ static $inject = ['AuthService', '$state'];
+
+ /** @ngInject */
+ constructor(
+ private authService: AuthService,
+ private $state: angular.ui.IStateService
+ ) {
+ }
+
+ public login(username: string, password: string) {
+ this.authService.login({
+ username: username,
+ password: password
+ })
+ .then(res => {
+ console.log(res);
+ this.$state.go('app');
+ })
+ .catch(e => console.error);
+ }
+}
+
+export const xosLogin: angular.IComponentOptions = {
+ template: require('./login.html'),
+ controllerAs: 'vm',
+ controller: LoginCtrl
+};