-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from somenathmaji/staging
repro ItemChanged issue
- Loading branch information
Showing
12 changed files
with
70 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<p> | ||
another works! | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-another', | ||
templateUrl: './another.component.html', | ||
styleUrls: ['./another.component.css'] | ||
}) | ||
export class AnotherComponent implements OnInit { | ||
|
||
constructor() { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { NgModule } from "@angular/core"; | ||
import { RouterModule, Routes } from "@angular/router"; | ||
import { AnotherComponent } from "./another/another.component"; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: "another", | ||
component: AnotherComponent | ||
} | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forRoot(routes, { useHash: true, enableTracing: true })], | ||
exports: [RouterModule] | ||
}) | ||
export class AppRoutingModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
{{subject}} | ||
<p> | ||
app works! | ||
</p> | ||
<router-outlet></router-outlet> | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
import { ChangeDetectorRef, Component, NgZone, OnInit } from "@angular/core"; | ||
import { OfficeService } from "./office.service"; | ||
import { Component, OnInit } from "@angular/core"; | ||
import { Router } from "@angular/router"; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.css'] | ||
}) | ||
export class AppComponent implements OnInit{ | ||
|
||
public subject = ""; | ||
|
||
constructor( | ||
private officeService : OfficeService | ||
private router: Router | ||
) {} | ||
|
||
ngOnInit(): void { | ||
this.subject = (window as any).Office.context.mailbox.item.subject; | ||
if (this.officeService.isItemChangedEventAvailable()) { | ||
console.log("[app-component] Registering to ItemChanged event"); | ||
this.officeService.registerEventHandler((window as any).Office.EventType.ItemChanged, func => this.updateSubject()); | ||
} else { | ||
console.warn("[app-component] Skipping registering for ItemChanged event"); | ||
} | ||
(<any>window).Office.context.mailbox.addHandlerAsync( | ||
(<any>window).Office.EventType.ItemChanged, | ||
() => {console.error('hello!!'); this.itemChangedEventHandler()}, | ||
() => {console.error('registered')}); | ||
} | ||
|
||
public updateSubject() { | ||
this.subject = (window as any).Office.context.mailbox.item.subject; | ||
console.log(this.subject); | ||
public itemChangedEventHandler = () => { | ||
this.switchView(); | ||
} | ||
|
||
public switchView = () => { | ||
this.router.navigate(["another"], { replaceUrl: true }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.