我正在使用angular cli AoT编译.当我尝试按照本教程制作延迟加载组件时,我收到以下错误:
ERROR Error: Uncaught (in promise): TypeError: __webpack_require__.e is not a function
TypeError: __webpack_require__.e is not a function
at webpackAsyncContext (eval at ./src/$$_lazy_route_resource lazy recursive (main.bundle.js:13), <anonymous>:15:29)
at SystemJsNgModuleLoader.loadAndCompile (core.js:6554)
at SystemJsNgModuleLoader.load (core.js:6538)
at RouterConfigLoader.loadModuleFactory (router.js:4543)
at RouterConfigLoader.load (router.js:4523)
at MergeMapSubscriber.eval [as project] (router.js:2015)
at MergeMapSubscriber._tryNext (mergeMap.js:128)
at MergeMapSubscriber._next (mergeMap.js:118)
at MergeMapSubscriber.Subscriber.next (Subscriber.js:92)
at ScalarObservable._subscribe (ScalarObservable.js:51)
at webpackAsyncContext (eval at ./src/$$_lazy_route_resource lazy recursive (main.bundle.js:13), <anonymous>:15:29)
at SystemJsNgModuleLoader.loadAndCompile (core.js:6554)
at SystemJsNgModuleLoader.load (core.js:6538)
at RouterConfigLoader.loadModuleFactory (router.js:4543)
at RouterConfigLoader.load …Run Code Online (Sandbox Code Playgroud) 我尝试为选项添加默认值.它就像一种占位符,我用这种方法来做.在纯HTML中它可以工作,但如果我尝试使用*ngForangular 2属性,它不会选择任何东西.
这是我在纯HTML中使用的代码:
<select name="select-html" id="select-html">
<option value="0" selected disabled>Select Language</option>
<option value="1">HTML</option>
<option value="2">PHP</option>
<option value="3">Javascript</option>
</select>
Run Code Online (Sandbox Code Playgroud)
并使用Angular模板:
<select name="select" id="select" [(ngModel)]="selectLanguage">
<option *ngFor="let item of selectOption"
[selected]="item.value==0"
[disabled]="item.value==0">{{item.label}}</option>
</select>
Run Code Online (Sandbox Code Playgroud)
这堂课是
import {Component} from '@angular/core';
@Component({
moduleId: module.id,
selector: 'app-form-select',
templateUrl: 'default.component.html'
})
export class DefaultComponent {
private selectOption: any;
constructor() {
this.selectOption = [
{
id: 1,
label: "Select Language",
value: 0
}, {
id: 2,
label: "HTML 5",
value: 1
}, {
id: …Run Code Online (Sandbox Code Playgroud) 我找到了本教程,其中讨论了如何使用浏览器同步的pre-gzipped资源示例.
它拿起*.html,*.css,*.js,*.{jpg,png}在Firefox v51.0.1(当前版本),但与上一版本(V50),它产生404错误与.html文件,但发现预gzip压缩的文件复制到另一个文件.
据我所知,它没有找到该文件,因为在预先压缩的资源中,文件是.*.gzip.
我不明白的是,为什么firefox lt 51不会渲染connect-gzip-static告诉它渲染的文件.
这是我的bs-config.js:
var Environement = require("./env");
var indexFile = Environement.enableProd ? '/index.html' : '/index_dev.html';
var middleware = require('connect-gzip-static')('./web_app');
module.exports = {
notify: false,
logLevel: "silent",
server: {
middleware: {
0: null, // removes default `connect-logger` middleware
1: require('connect-history-api-fallback')({
index: indexFile
}),
2: middleware
}
},
ghostMode: false
};
Run Code Online (Sandbox Code Playgroud)
有没有其他方法可以解决这个问题?这里有没有人遇到过和我一样的问题?
注意:使用chrome,IE Edge和FF v51,它可以完美运行.
假设我在下面有这个功能:
var a = 0;
function test () {
return new Promise(function (resolve, reject) {
a++;
if (a < 10) {
test()
reject(a)
} else {
resolve(a)
}
})
}
test().then(function (a) {
console.log('resolve', a)
}).catch(function (a) {
console.log('reject', a)
})Run Code Online (Sandbox Code Playgroud)
它打印:
拒绝 10
我希望它会打印reject 1 ... 10.
我怎样才能做到这一点?
是否可以使用外部按钮使用Dropzone插件添加文件?我找到了这个文档,但它没有回答我的问题.实际上,我无法使用诸如click之类的处理程序事件来添加文件.有解决方案吗?
我正在尝试发送本地邮件,但它总是会生成此错误:Must issue a STARTTLS command first.我试图找到解决方案,我找到了这个网站,该网站展示了如何在 Windows 下配置 PHP 以使用 gmail 或外部 STMP 服务器,我按照每个步骤进行操作,但它总是会生成同样的错误。我迷路了!!
有没有人以前遇到过这个问题?我很感激你的帮助...
我有这个小提琴.
当我点击路径时,我想要缩放它.但是在缩放之后,点击的路径失去了他当前的位置.
这是我的jQuery代码:
var svg = $("#svg-container");
svg.load("svg/fondcarte-collec_actuelle.svg", function(data) {
svg.children().find("path").click(function(e) {
$("#Layer_1 path").removeAttr("style");
var x = e.pageX - svg.width() - $(this).offset().left - this.getBoundingClientRect().width + svg.find("svg").offset().left + 250;
var y = e.pageY - svg.height() - $(this).offset().top - this.getBoundingClientRect().height + svg.find("svg").offset().top + 250;
console.log(this.x, this.y)
$(this).css("transform", "translate(" + x + "px, " + y + "px) scale(1.3)");
$(this).css("fill", "green");
})
})
Run Code Online (Sandbox Code Playgroud)
怎么做到呢?
注意:我没有插件就问过它,因为我想了解这个缩放概念.
提前致谢.
我需要将某些 DOM 元素从某个位置设置为 0px,但它不适用于animejs。
CSS:
.animate {
transform: translateX(50px);
width: 50px;
height: 50px;
background: #12acec;
border-radius: 50%;
}
Run Code Online (Sandbox Code Playgroud)
这里是JS:
anime({
targets: '.animate',
translateX: 0,
duration: 300
})
Run Code Online (Sandbox Code Playgroud)
如果我检查该元素,我会发现该元素立即设置为 translateX(0px) (fiddle 1)。
但如果我使用不同于 0 的值,它就可以工作(fiddle 2)。
这是animejs的错误还是我做错了?如果这是一个错误,有没有办法用animejs处理translateX上的0值?
更新: 我的目标是处理连续动画......
<div class="handwritting">
<span>T</span>
<span>e</span>
<span>x</span>
<span>t</span>
</div>
Run Code Online (Sandbox Code Playgroud)
js手写体
anime({
targets: '.handwritting span',
opacity: 1,
duration: 5000,
delay: function (_, i) {
return i * 100
}
})
Run Code Online (Sandbox Code Playgroud)
...但它不适用于翻译,但适用于不透明度。(小提琴3)
谢谢
javascript ×3
angular ×2
angular-cli ×1
anime.js ×1
browser-sync ×1
dropzone.js ×1
gmail ×1
html ×1
jquery ×1
lazy-loading ×1
php ×1
recursion ×1
smtp ×1
svg ×1