我无法在Angular 1.2.13中创建成功的get请求.
var getProgress = function() {
var promise = $http({method: 'GET', url: 'http://localhost:8080/project/local/some/getStatus'});
promise.then(function(success) {
alert(JSON.stringify(success));
}, function(error) {
alert(JSON.stringify(error));
}, function(notify) {
alert(JSON.stringify(notify));
});
};
Run Code Online (Sandbox Code Playgroud)
所以我试图从我的REST Web服务接收一些JSON.为了测试该服务,我从浏览器(IE9,Firefox 27,Chrome 33)访问它可以在所有这些中正常工作.
上面的代码使用angular但总是提示我错误:
*{"data":"","status":404,"config":{"transformRequest":[null],"transformResponse":[null],"method":"GET","url":,"http://localhost:8080/project/local/some/getStatus""标题":{"接受":"application/json,text/plain,/ "}}}*
使用wireshark我检查HTTP请求和HTTP响应,从浏览器和角度返回200调用Web服务,以及所需的json对象!然而,角度提示我404.
当我从Firefox USING ANGULAR发出get请求并使用Findbugs进行调试时,在控制台中我获得了HTTP Code 200,然而Angular说404.尝试调整角度的代码无济于事,看不出有什么奇怪的.
上面的代码在IE9中正常工作!
任何建议表示赞赏.
我想在Angular2中创建一个可选列表:
import {Directive, ElementRef, HostListener, Input, Output, EventEmitter} from "@angular/core";
@Directive({selector: 'li'})
export class ListItem {
@Input() private selectableItem: any;
@Output('selectedEvent') private selectedEvent: EventEmitter<any> = new EventEmitter<any>();
constructor(private hostElement: ElementRef) {
}
@HostListener('click', ['$event'])
private toggleSelected(event: MouseEvent): void {
this.hostElement.nativeElement.classList.toggle('selected');
this.selectedEvent.emit(this.selectableItem);
}
}
@Directive({selector: '[selectableList]'})
export class SelectableListDirective {
constructor(private hostElement: ElementRef) {
}
@HostListener('selectedEvent', ['$event'])
private liWasClicked(event): void {
console.log(event);
}
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试像这样使用它:
<ul selectableList>
<li *ngFor="let item of items" [selectableItem]="item">
<span>{{item}}</span>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)

在RootProject中,我有build.gralde和settings.gradle.common,subProj1和subProj2是settings.gradle中的子项目
intermediateDir 不是子项目!它仅用于对subProj1,subProj2进行分组,因为它们是相关的.
每次我在根目录中运行"gradle eclipse"时,我也会在intermediateDir中获得.classpath和.project文件,我不应该这样做,因为这不是子项目!所以基本上middleDir被认为是某些任务的子项目,即使不在settings.gradle中也是如此.有什么快速的方法吗?