Skip to content

Commit

Permalink
bug fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
Oktawian-L committed Nov 3, 2019
1 parent 4d15e31 commit 8d8adb0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Subiton/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { UserDetailResolver } from './_resolvers/user-details.resolver';
import { UserListResolver } from './_resolvers/user-list.resolver';
import { UserEditComponent } from './users/user-edit/user-edit.component';
import { UserEditResolver } from './_resolvers/user-edit.resolver';
import { PreventUnsavedChanges } from './_guards/prevent-unsaved-changes.guard';

// defining reading token early om
export function tokenGetter() {
Expand Down Expand Up @@ -75,7 +76,8 @@ export function tokenGetter() {
ErrorInterceptorProvider,
UserDetailResolver,
UserListResolver,
UserEditResolver
UserEditResolver,
PreventUnsavedChanges
],
bootstrap: [
AppComponent
Expand Down
5 changes: 4 additions & 1 deletion Subiton/src/app/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ import { UserDetailResolver } from './_resolvers/user-details.resolver';
import { UserListResolver } from './_resolvers/user-list.resolver';
import { UserEditComponent } from './users/user-edit/user-edit.component';
import { UserEditResolver } from './_resolvers/user-edit.resolver';
import { PreventUnsavedChanges } from './_guards/prevent-unsaved-changes.guard';

export const appRoutes: Routes = [
{ path: 'home', component: HomeComponent },
{ path: '', runGuardsAndResolvers: 'always', canActivate: [AuthGuard],
children: [
{ path: 'users', component: UserListComponent, resolve: { users: UserListResolver } },
{ path: 'users/:id', component: UserDetailsComponent, resolve: {user: UserDetailResolver} },
{ path: 'profile/edit', component: UserEditComponent, resolve: { user: UserEditResolver } },
{ path: 'profile/edit', component: UserEditComponent,
resolve: { user: UserEditResolver },
canDeactivate: [PreventUnsavedChanges] },
{ path: 'likes', component: LikesComponent },
{ path: 'messages', component: MessagesComponent }
] },
Expand Down
2 changes: 1 addition & 1 deletion Subiton/src/app/users/user-edit/user-edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class UserEditComponent implements OnInit {
galleryOptions: NgxGalleryOptions[];
galleryImages: NgxGalleryImage[];

@ViewChild('editForm') editForm: NgForm;
@ViewChild('editForm', { static: false }) editForm: NgForm;

constructor(private route: ActivatedRoute,
private alertify: AlertifyService) { }
Expand Down

0 comments on commit 8d8adb0

Please sign in to comment.