我正在按照制作github页面的说明,忘记进入我的git子目录.结果,我只是使用了一个完整的文档目录git clean -fdx.有什么办法可以解除这个可怕的错误吗?
当我从头创建一个observable并且有观察者错误然后完成时,永远不会调用订阅的完成部分.
var observer = Rx.Observable.create(function(observer){
observer.onError(new Error('no!'));
observer.onCompleted();
})
observer.subscribe(
function(x) { console.log('succeeded with ' + x ) },
function(x) { console.log('errored with ' + x ) },
function() { console.log('completed') }
)
Run Code Online (Sandbox Code Playgroud)
输出是:
errored with Error: no!
Run Code Online (Sandbox Code Playgroud)
我希望它是:
errored with Error: no!
completed
Run Code Online (Sandbox Code Playgroud)
如果我更改代码以调用onNext而不是onError,则observable正确完成:
var observer = Rx.Observable.create(function(observer){
observer.onNext('Hi!');
observer.onCompleted();
})
observer.subscribe(
function(x) { console.log('succeeded with ' + x ) },
function(x) { console.log('errored with ' + x ) },
function() { console.log('completed') }
)
Run Code Online (Sandbox Code Playgroud)
我得到了预期的输出:
succeeded with Hi! …Run Code Online (Sandbox Code Playgroud) 我有以下Json从Twitter获得
+ token {[
{
"trends": [
{
"name": "Croke Park II",
"url": "http://twitter.com/search?q=%22Croke+Park+II%22",
"promoted_content": null,
"query": "%22Croke+Park+II%22",
"events": null
},
{
"name": "#twiznight",
"url": "http://twitter.com/search?q=%23twiznight",
"promoted_content": null,
"query": "%23twiznight",
"events": null
},
{
"name": "#Phanhattan",
"url": "http://twitter.com/search?q=%23Phanhattan",
"promoted_content": null,
"query": "%23Phanhattan",
"events": null
},
{
"name": "#VinB",
"url": "http://twitter.com/search?q=%23VinB",
"promoted_content": null,
"query": "%23VinB",
"events": null
},
{
"name": "#Boston",
"url": "http://twitter.com/search?q=%23Boston",
"promoted_content": null,
"query": "%23Boston",
"events": null
},
{
"name": "#rtept",
"url": "http://twitter.com/search?q=%23rtept",
"promoted_content": null,
"query": "%23rtept",
"events": null …Run Code Online (Sandbox Code Playgroud) Visual Studio中是否有一个关键的快捷方式,可以在不使用Resharper或任何其他工具的情况下查找和打开解决方案中的文件?
我想使用 DatePipe 转换数字(代表秒)以获得如下结果:
00:00:05
我试过用 DatePipe 这样做:
<label>No timezone (default) {{ 5 * 1000 | date:'h:mm:ss'}}</label>
Run Code Online (Sandbox Code Playgroud)
但它产生的结果包含时区 +4(这不是我想要的):
4:00:05
所以为了避免这种情况,我试图将时区偏移设置为 0:
<label>{{ 5 * 1000 | date:'h:mm:ss z':'+0000'}}</label>
<label>{{ 5 * 1000 | date:'h:mm:ss z':'UTC'}}</label>
<label>{{ 5 * 1000 | date:'h:mm:ss z':'GMT'}}</label>
<label>{{ 5 * 1000 | date:'h:mm:ss z':'GMT+0'}}</label>
<label>{{ 5 * 1000 | date:'h:mm:ss z':'UTC+0'}}</label>
Run Code Online (Sandbox Code Playgroud)
但这一次时间移动了 12 小时而不是 0:
12:00:05 格林威治标准时间+0
那么有没有一种方法可以在不移动时区的情况下使用 DatePipe 将秒转换为时间?
或者是否有任何其他角度的管道可用于此目的?
虽然Goto Defnition如预期与重点工作F12,
热键Alt+ F12为Peek Definition不再做任何事情.
如何恢复Alt+ F12功能?
在这里,我们有一个git repo,它具有多个以相同前缀开头的分支,如下所示:
pfx.branchName1
pfx.branchName2
pfx.branchName3
...
Run Code Online (Sandbox Code Playgroud)
因此,问题是如何从所有分支中快速删除所有前缀(“ pfx。”)并获得如下所示的内容:
branchName1
branchName2
branchName3
...
Run Code Online (Sandbox Code Playgroud) 我想获取 base64 字符串并用它来显示图像。
下面是 HTML 文件。我想使用 base64 字符串并在 img 标签中使用它:
<ion-content>
<ion-card>
<img src={{imageFileBinary}} />
<ion-card-header>
<form>
<ion-input id="myform" type="file" name="file" (change)="postMethod($event.target.files)"></ion-input>
</form>
<ion-card-title>Nick</ion-card-title>
</ion-card>
</ion-content>Run Code Online (Sandbox Code Playgroud)
我从 .ts 文件中获取 imageFileBinary。
下面是 .ts 文件:
export class MyprofilePage implements OnInit {
imageFileBinary;
userDetails: UserDetails;
constructor(private profileDetailService: ProfileDetailsService, private httpClient: HttpClient) {}
fileToUpload;
getProfileDetails() {
this.profileDetailService.getUserDetails('email').subscribe((userDetails: UserDetails) => {
this.imageFileBinary = userDetails.imageFileBinary
});
}
postMethod(files: FileList) {
this.fileToUpload = files.item(0);
let formData = new FormData();
formData.append('file', this.fileToUpload, this.fileToUpload.name);
this.httpClient.post("http://localhost:8080/uploadFile", formData).subscribe((val)=> {
console.log(val);
}); …Run Code Online (Sandbox Code Playgroud)以Alt(例如Peek Definition Alt + F12)开头的键盘快捷键在Visual Studio 2015上停止工作.
当我按下Alt键时,这些下划线出现在菜单项下(这是Windows的默认行为),如图所示
其他键盘快捷键,如F5以及所有开头的键盘快捷键Ctrl都正常工作.
我在安装ReSharper后找到了很多关于键盘快捷键冲突的答案,但我还没有安装它.
有什么建议?