So I have a sample app, and I created auth custom components similar to socially app example.
So I have a main.html in client
<head>
<title>AGC-Backend</title>
<base href="/">
</head>
<body>
<h2>Default Page</h2>
<default></default>
</body>
And main.js:
import angular from ‘angular’;
import angularMeteor from ‘angular-meteor’;
import { name as Default} from '../imports/components/default/default';
function onReady() {
angular.bootstrap(document, [
Default
], {
strictDi: true
});
}
And then insode imports folder, I have default, login,register , auth
default.html:
<auth ui-view=""></auth>
default.js
import angular from 'angular';
import angularMeteor from 'angular-meteor';
import uiRouter from 'angular-ui-router';
import template from './default.html';
import { name as Auth } from '../auth/auth';
class Default{}
const name = 'default';
// create a module
export default angular.module(name, [
angularMeteor,
uiRouter,
Auth
]).component(name, {
template,
controllerAs: name,
controller:Default
})
.config(config);
function config($locationProvider, $urlRouterProvider) {
'ngInject';
$locationProvider.html5Mode(true);
$urlRouterProvider.otherwise('/login');
}
auth.html
<div>
<button ng-href="login">Login</button>
<button href="register">Sign up</button>
<button ng-click="auth.logout()" >Logout</button>
</div>
auth.js
import angular from 'angular';
import angularMeteor from 'angular-meteor';
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import template from './auth.html';
import { name as Login } from '../login/login';
import { name as Register } from '../register/register';
const name = 'auth';
class Auth {
constructor($scope, $reactive) {
'ngInject';
$reactive(this).attach($scope);
this.helpers({
});
}
logout() {
Accounts.logout();
}
}
// create a module
export default angular.module(name, [
angularMeteor,
Login,
Register,
]).component(name, {
template,
controllerAs: name,
controller: Auth
});
I also have basic login and register code.
I used to get it working before I added router( I had a single page with all controls which are now seperated into diff views).
When I run, all I get is an empty page.
What could I being doing wrong?
Please let me know , if you need additional info.
Thanks,