Я пытаюсь переместить веб-приложение на Angular2.Я успешно переместил HTML и CSS в angular's component.html & component.css соответственно.Однако у меня возникли проблемы с файлами .js.
Как включить файл .js в component.ts?
.js файл:
A = (function(w){
var init = function(){};
var scrollToElement = function(){};
}(window);
$(document).ready(function() {
A.init();
A.scrollToElement();
....
});
component.ts
import { Component, OnInit } from '@angular/core';
declare var $: any;
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
constructor() { }
ngOnInit() {
$.getScript('assets/js/script.js');
}
}
Это правильно?Что я делаю не так?