我如何为我的TypeScript模块需要jquery AMD模块.例如,假设脚本的目录结构如下所示:
jquery-1.8.2.js
jquery.d.ts
module.ts
require.js
我希望从module.ts生成的js文件要求通过require.js加载jquery-1.8.2.js.
目前我有:
import jquery = module('jquery')
这导致当前范围中不存在名称"jquery".
我用RxJs 6运行Angular 6.
我试图从paramMap中获取值并将其分配给属性.路线看起来像这样:
{
path: 'post/:postName',
component: PostComponent
}
Run Code Online (Sandbox Code Playgroud)
post组件目前看起来像这样:
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, ParamMap } from '@angular/router';
import { switchMap } from 'rxjs/operators';
import { Observable, of } from 'rxjs';
import * as matter from 'yaml-front-matter';
import { Post } from '../../models/post';
@Component({
selector: 'blog-post',
templateUrl: './post.component.html',
styleUrls: ['./post.component.css'],
encapsulation: ViewEncapsulation.Emulated
})
export class PostComponent implements OnInit {
created: Date;
postName = '';
markdown = '';
title = '';
loading = …Run Code Online (Sandbox Code Playgroud)