我有这样的点击事件
<button (click)="toggle($event)" class="someclass" id="btn1"></button>
<button (click)="toggle($event)" class="someclass" id="btn2"></button>
Run Code Online (Sandbox Code Playgroud)
我正在我的函数输入参数中捕获该事件,并想要找出单击按钮的确切内容.
toggle(event) {
}
Run Code Online (Sandbox Code Playgroud)
但event没有id财产.
altKey: false
bubbles: true
button: 0
buttons: 0
cancelBubble: false
cancelable: true
clientX: 1198
clientY: 29
ctrlKey: false
currentTarget: button#hdrbtn_notificaton.mdl-button.mdl-js-button.mdl-js-ripple-effect.mdl-button--icon
defaultPrevented: false
detail: 1
eventPhase: 3
fromElement: null
isTrusted: true
isTrusted: true
layerX: -566
layerY: 5
metaKey: false
movementX: 0
movementY: 0
offsetX: 22
offsetY: 13
pageX: 1198
pageY: 29
path: Array[13]
relatedTarget: null
returnValue: true
screenX: 1797
screenY: 148
shiftKey: false …Run Code Online (Sandbox Code Playgroud) 我引用然后声明了一个图标
<i class="material-icons">face</i>
Run Code Online (Sandbox Code Playgroud)
但是如何更改图标大小?
在官方网站https://design.google.com/icons/我可以看到他们使用类似class="md-icon dp48"但在我的情况下不起作用.
我有这样的方法:
public async Task<MyResult> GetResult()
{
MyResult result = new MyResult();
foreach(var method in Methods)
{
string json = await Process(method);
result.Prop1 = PopulateProp1(json);
result.Prop2 = PopulateProp2(json);
}
return result;
}
Run Code Online (Sandbox Code Playgroud)
然后我决定使用Parallel.ForEach:
public async Task<MyResult> GetResult()
{
MyResult result = new MyResult();
Parallel.ForEach(Methods, async method =>
{
string json = await Process(method);
result.Prop1 = PopulateProp1(json);
result.Prop2 = PopulateProp2(json);
});
return result;
}
Run Code Online (Sandbox Code Playgroud)
但现在我有一个错误:
在异步操作仍处于挂起状态时完成异步模块或处理程序.
我有这个开始参考 package.json
"scripts": {
"start": "node bin/www"
},
Run Code Online (Sandbox Code Playgroud)
当我打字时它正在运行我的快速应用程序npm start.
但我希望浏览器同时打开http://localhost:8081.我怎么能说start打开我的本地网址呢?
喜欢: "start": "node bin/www, http://localhost:8081"
因此,当我打字时,npm satrt它运行我的快递应用程序并同时打开网址.
灯塔建议修复我的href文本
我有这样的HTML
<a href="https://twitter.com/@some-name-here" target="_blank" rel="noopener" class="social-icon twitter grayscale"></a>
Run Code Online (Sandbox Code Playgroud)
这里真正发生的是我只是使用css类在href中显示图像:
.social-icon.twitter {
background: url('../images/logo-twitter.png') no-repeat center center;
}
Run Code Online (Sandbox Code Playgroud)
我不能这样做,<a....>Twitter</a>因为显示的文本会破坏视图.
我想不出其他任何事情,比如只是span在我的文本中放入一个文本a并将其隐藏起来,<a....><span class="hide">Twitter</span></a>但是想知道是否有任何正确的解决方案?
对此有何建议?
以下是常规请求:
this.people = http.get('http://localhost:3000/users')
.map(response => response.json());
Run Code Online (Sandbox Code Playgroud)
有什么方法可以达到/超时吗?
我有这种javascript:
$.ajax({
url: "//myapi.com/json",
dataType: "jsonp"
}).done(function (data) {
selectText('Id', data.country);
}).fail(function (jqXHR, textStatus, errorThrown) {
var defaultOption = 'US'
selectDropdownByText('Id', defaultOption);
console.log(errorThrown);
});
Run Code Online (Sandbox Code Playgroud)
但问题是,在https请求我的ajax无法正常工作,因为我调用的服务无法通过https访问,而且我收到错误:ERR_CONNECTION_REFUSED- 所以很好,我只是想处理它.我有一个.failajax调用,但它没有处理:ERR_CONNECTION_REFUSED
你能就:ERR_CONNECTION_REFUSED这种情况下如何处理提出建议吗?
我也试图将我的ajax调用封装到try-catchblock,但它也没有工作.
我刚添加remote A了我的另外repo B,然后运行git fetch A
如何撤消提取?如果我只是删除remote A:git remote remove A1它会撤消提取吗?
更新:
repo B
repo A
以上是我运行的命令,结果我将所有分支都提取到了我repo B但是我只需要一个特定的分支remote A,我需要它进入特定文件夹repo B但是这是另一个故事两个不同的git存储库之间的合并代码
我刚刚从这里举了一个例子https://angular.io/guide/quickstart
我根据快速入门手册完成了所有工作.但是在app.ts编译时在WebStorm控制台中收到警告.
这是详细信息:
我在Windows 8.1 x64,Webstorm 11.0.1上
app.ts:
import {bootstrap, Component} from 'angular2/angular2';
@Component({
selector: 'my-app',
template: '<h1>My First Angular 3 App</h1>'
})
class AppComponent { }
bootstrap(AppComponent);
Run Code Online (Sandbox Code Playgroud)
tsconfig.json:
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"sourceRoot": "/"
},
"exclude": [
"node_modules"
]
}
Run Code Online (Sandbox Code Playgroud)
我将tsconfig.json文件放在文件app夹和根目录中.
在app.ts实际得到的文件汇编,但得到某种原因的警告:
error TS1148: Cannot compile modules unless the '--module' flag is provided.
error TS2307: …Run Code Online (Sandbox Code Playgroud) 我已经按照本教程编写了代码:
context = new AudioContext();
play(frequency) {
const o = this.context.createOscillator();
const g = this.context.createGain();
o.connect(g);
g.connect(this.context.destination);
g.gain.exponentialRampToValueAtTime(
0.00001, this.context.currentTime + 1
);
o.frequency.value = frequency;
o.start(0);
}
Run Code Online (Sandbox Code Playgroud)
这样我可以播放从任何注释教程通过传递值表1175,2794等
我决定创建一个音符数组,并play在循环中调用我的函数,它只是没有工作,因为所有音符只是一次播放没有延迟.
你会如何按顺序播放音符数组?
我也在查看那篇文章,但仍然无法弄清楚我如何调整上面的代码.
angular ×4
css ×2
javascript ×2
ajax ×1
async-await ×1
audiocontext ×1
c# ×1
express ×1
git ×1
git-fetch ×1
git-remote ×1
html ×1
http ×1
icons ×1
jquery ×1
lighthouse ×1
node.js ×1
npm ×1
sequence ×1
webstorm ×1