'use strict'; angular .module('app') .component('main', { templateUrl: '/resources/main/main.component.html', controller: ['$rootScope', '$scope', '$location', 'cms', function ($rootScope, $scope, $location, cms) { Object.assign($scope, { user: cms.user, logout: _ => { cms.Logout().then(_ => { $location.path('/signin') }) } }) let locker = false; const app = document.querySelector('app'); app.addEventListener('scroll', e => { const position = (app.offsetHeight + app.scrollTop) >= (app.scrollHeight - 200); if (position && !locker) { locker = true; setTimeout(() => { locker = false }, 1000); $rootScope.$emit('scroll-end', {}) } }) }], $routeConfig: [ { path: '/dashboard', name: 'Dashboard', component: 'dashboard' }, { path: '/news', name: 'News', component: 'news' }, { path: '/news/:id', name: 'Post', component: 'post' } ] });