从最近两天开始,我试图让ngSwitch在角度2.1.0中工作.但似乎不可能让它发挥作用.
我总是得不到NgSwitch的提供者.以下是我的代码 -
模板 -
<template [ngSwitch]="buttonSelector">
<a class="btn" [ngClass]="buttonSizeClass" *ngSwitchCase="'link'" href="#">
<span class="btn__text">
<ng-content></ng-content>
</span>
</a>
</template>
Run Code Online (Sandbox Code Playgroud)
零件 -
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-inked-btn',
templateUrl: './inked-btn.component.html',
styleUrls: ['./inked-btn.component.css'],
inputs: ['buttonSize', 'buttonType', "buttonSelector"]
})
export class InkedBtnComponent implements OnInit {
public buttonSize: string;
public buttonType: string;
public buttonSelector: string;
public buttonSizeClass: any;
constructor() { }
ngOnInit() {
this.buttonSizeClass = {
'btn--lg': this.buttonSize === 'large',
'btn--sm': this.buttonSize === 'small',
'btn--primary': this.buttonType === 'primary'
}
} …
Run Code Online (Sandbox Code Playgroud) class C{
static int f1(int i) {
System.out.print(i + ",");
return 0;
}
public static void main (String[] args) {
int i = 0;
i = i++ + f1(i);
System.out.print(i);
}
}
Run Code Online (Sandbox Code Playgroud)
怎么回答是1,0.请解释.
我正在研究JSONP回调函数的概念.我阅读了一些有关这方面的文章,并希望能够很好地掌握JSONP的概念.
所以,我将一个json文件上传到服务器--json文件
这是我编写的用于检索数据的js代码.电话是从localhost到abhishekprakash.com.
var xhr;
var dataList;
xhr = new XMLHttpRequest();
xhr.open('GET', 'http://abhishekprakash.com/script/example.json?callback=func_callbk', true);
xhr.send();
func_callback = function(data){
alert(data.data.people[0].id);
}
xhr.onreadystatechange = function(){
if(xhr.readyState == 4){
console.log(dataList);
}
};
Run Code Online (Sandbox Code Playgroud)
这是我在控制台中得到的响应:
调用回调函数但它不包含Json数据.我错过了什么?
任何帮助表示赞赏.
谢谢
我正在使用express-jwt来构建一个宁静的 api。现在客户端正在进行重复的ajax调用,第一个发起者是angularjs,第二个发起者是other。第一个得到 204 作为响应代码,第二个得到 200 作为响应代码。我试图调试以找到这个重复请求的来源,但我不能。
以下是带有 204 状态代码的标题的详细信息
以下是带有 204 状态代码的标题的详细信息
任何人都可以建议可能是什么问题吗?