我正在研究日期格式化的moment.js和我在这些令牌来了:有没有之间的任何差别显著WoY和WoY ISO?
一周的一周
w - 1 2 ... 52 53
wo - 1st 2nd ... 52nd 53rd
ww - 01 02 ... 52 53
Run Code Online (Sandbox Code Playgroud)
一年中的一周(ISO)
W - 1 2 ... 52 53
Wo - 1st 2nd ... 52nd 53rd
WW - 01 02 ... 52 53
Run Code Online (Sandbox Code Playgroud) 我正在利用以前的大型角度2应用程序的经验.我一直非常小心地控制渲染周期.保存日志是我如何调查发生的事情.
调节器
public debugTemplate() {
DEBUG.render && debug('Render FooCmp');
}
Run Code Online (Sandbox Code Playgroud)
模板
{{ debugTemplate() }}
Run Code Online (Sandbox Code Playgroud)
我一直在智能组件中只使用ngrx状态存储订阅.这样我就可以完全避免使用ActivatedRouteSnapshot或使用RouteReuseStrategy
守护
import { Injectable } from '@angular/core';
import { CanActivate, ActivatedRouteSnapshot,
RouterStateSnapshot } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import { environment } from '../../../environments/environment';
import { DEBUG } from '../../../config/config';
import * as Debug from 'debug';
// Interfaces
import { Foo } from '../interfaces/foo';
// Services
import { BarService } from '../services/bar.service';
import { FooService } from '../services/foo.service';
// …Run Code Online (Sandbox Code Playgroud) 在给定的 html 中,如何判断 dom 元素是浏览器定义的标准 html 组件还是脚本(作者)定义的 web 组件:
<div></div>
<custom-web-component></custom-web-component>
Run Code Online (Sandbox Code Playgroud)
我知道无法以编程方式检查 Web 组件是否已注册。他们也都被考虑HTMLElement。有没有办法检查 dom 节点是标准 html 还是自定义 Web 组件?让我们假设我使用querySelector()
我一个月前发现了这个小提琴并成功实现了它。除了特定场景外,它就像一个魅力。如果我调整窗口大小,从很小到很大,很明显相机投影矩阵没有更新。这种情况在 jsFiffle 示例和我的实现中都会发生。有什么可能的解决办法吗?谢谢你!
onWindowResize = function(){
screenWidth = window.innerWidth;
screenHeight = window.innerHeight;
camera1.aspect = screenWidth / screenHeight;
camera2.aspect = camera1.aspect;
camera3.aspect = camera1.aspect;
camera1.updateProjectionMatrix();
camera2.updateProjectionMatrix();
camera3.updateProjectionMatrix();
renderer.setSize( screenWidth, screenHeight);
}
Run Code Online (Sandbox Code Playgroud)
带有效果作曲家演示的大纲:http://jsfiddle.net/Eskel/g593q/5/
我正在尝试构建一个将承载ace编辑器的Web组件.问题是我没有找到有关如何导入模块和设置类型的足够信息.下面的代码使用简单的<script>标签和全局变量工作得很好.
到目前为止,这就是我所拥有的:
npm install ace-code-editor --save
npm install @types/ace --save-dev
Run Code Online (Sandbox Code Playgroud)
代码editor.cmp.ts
// Error: [ts] File '.../node_modules/@types/ace/index.d.ts' is not a module.
import * as ace from 'ace';
export class CodeEditorCmp extends HTMLElement {
// DOM
private editor: AceAjax; // How do I import the type. What type to use?
constructor() {
super();
}
connectedCallback() {
this.initCodeEditor();
}
initCodeEditor(){
this.editor = ace.edit("editor-vsc");
// How do I import the editor themes?
this.editor.setTheme("ace/theme/xcode");
// How do I import the editor modes?
var …Run Code Online (Sandbox Code Playgroud) 如何使用angular 2方法重构此代码?我在谷歌上找不到任何东西.
var tooltipsData = $.grep(tooltips, function (element, index) {
return (element.ProductCode == ProductCode);
});
Run Code Online (Sandbox Code Playgroud) 基本上我正在尝试在我的项目中创建两个不同的子文件夹,src并且dist.以下是我的应用中的重要部分:
C:\Server\htdocs\ C:\Server\htdocs\src<base href="/">router 3.0.0-rc.1部分system.config.js
var map = {
'app': 'src/',
'@angular': 'node_modules/@angular',
'angular2-in-memory-web-api': 'node_modules/angular2-in-memory-web-api',
'rxjs': 'node_modules/rxjs'
};
var packages = {
'app': { main: 'main.js', defaultExtension: 'js' },
'rxjs': { defaultExtension: 'js' },
'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }
};
Run Code Online (Sandbox Code Playgroud)
routes.ts
export const routes: RouterConfig = [
{
path: '',
component: WebComponent
},
{
path: 'admin',
component: AdminComponent
},
{
path: 'editor',
component: EditorComponent
} …Run Code Online (Sandbox Code Playgroud) javascript ×5
angular ×3
ecmascript-6 ×1
grep ×1
momentjs ×1
ngrx ×1
renderer ×1
three.js ×1
typescript ×1