Date : March 29 2020, 07:55 AM
|
Unexpected Token 'Import' issue in Jasmine, Protractor With Angular 2 Project with out angular-cli
Date : March 29 2020, 07:55 AM
Hope this helps You are importing MainPage but calling OperatorMainPage. OperatorMainPage type does not exist. import { MainPage } from './app.po';
describe('demo-project App', function() {
let page: MainPage;
beforeEach(() => {
page = new MainPage();
});
it('Application should have a title', () => {
page.navigateTo();
expect(page.getTitle()).toEqual('Operator - Flight Operation Management');
});
it('Dashbaord should have a heading', function() {
expect(page.getTitle()).toEqual('DASHBOARD');
});
});
|
Angular 2 project to Angular 4 update issue
Date : March 29 2020, 07:55 AM
this will help Steps to update application from angular 2 to angular 4. 1) Delete your node modules npm install @angular/{
animations,
common,
compiler,
compiler-cli,
core,
forms,
http,
platform-browser,
platform-browser-dynamic,
platform-server,
router
}@4.0.0 typescript@latest --save
import { BrowserAnimationsModule } from @angular/platform-browser/animations
|
Issue creating angular project with angular cli
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I am using Windows 10, I never had any issue using angular cli to create and run angular project, today i noticed i was still able to run old ones using ng serve but when i tried to create new ones with ng new *name* I had these warnings at the end of the creation logs: , npm install --save-dev @angular-devkit/core will solve this issue
|
Date : March 29 2020, 07:55 AM
With these it helps You are using Angular 4. This is a very old version. The violation warning in chrome is relatively new, considering how old angular 4 is. Which means that newer versions of angular, and the material library, have updated to prevent this warning. The only way for you to get rid of this warning is to downgrade chrome or finally update your angular (and material) version import { EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';
@NgModule({
providers: [
{
provide: EVENT_MANAGER_PLUGINS,
useClass: PassiveEventsOptionPlugin,
multi: true
}
]
})
export class AppModule {}
@Injectable()
export class PassiveEventsOptionPlugin {
private readonly passiveEvents = [
'touchstart'
];
constructor(@Inject(DOCUMENT) private doc: any) {}
supports(eventName: string): boolean {
return this.passiveEvents.some((event) => eventName.startsWith(event));
}
addEventListener(el: HTMLElement, event: string, listener: EventListener): () => void {
// this is the important part. Adding the passive option
const options = { passive: true };
element.addEventListener(type, listener, options);
return () => element.removeEventListener(type, listener, options);
}
addGlobalEventListener(
element: GlobalEventTarget,
eventName: string,
listener: EventListener
): () => void {
let target: EventTarget | undefined;
if (element === 'window') {
target = window;
} else if (element === 'document') {
target = this.doc;
} else if (element === 'body' && this.doc) {
target = this.doc.body;
}
return this.addEventListener(target as HTMLElement, eventName, listener);
}
}
|