我的app.module.ts中有这个:
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { HttpModule, Http } from '@angular/http';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { EliteApi } from '../shared/shared';
import { MyApp } from './app.component';
import { MyTeams, Tournaments, TeamDetails, Teams, TeamHome, Standings } from '../pages/pages';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
@NgModule({
declarations: [
MyApp,
MyTeams,
TeamDetails,
Tournaments,
Teams,
TeamHome,
Standings
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
HttpModule …Run Code Online (Sandbox Code Playgroud) 如何追加物品Observable?
这是一些代码:
this.logEntries = this.controllerService.getLog(this.controller.remoteID, this.skip, this.max);
this.logEntries.subscribe(a => {
this.allLogEntries.add(this.logEntries)
});
Run Code Online (Sandbox Code Playgroud)
这是他们的声明:
logEntries: Observable<Log[]>;
allLogEntries: Observable<Log[]> = Observable.empty<Log[]>();
Run Code Online (Sandbox Code Playgroud)
我想将项目附加到allLogEntries,因为它们是从Web服务中提取的.我该怎么做呢?
我有一个List和我有新订单,其中List应该有int[]我想要的项目List应该按照项目重新排序int[].这是我的代码:
class Program
{
static void Main(string[] args)
{
List<Test> tests = new List<Test>() {
new Test(){ No = 201 },
new Test(){ No = 101 },
new Test(){ No = 300 },
new Test(){ No = 401 },
new Test(){ No = 500 },
new Test(){ No = 601 }
};
int[] newOrder = new int[6] { 201, 401, 300, 101, 601, 500 };
//after the opration the List …Run Code Online (Sandbox Code Playgroud) 我刚刚开始使用 Angular 2。它实际上让我考虑了仅用于 Hello World 的页面大小。
请查看实际需要的脚本,它已经是 1.75 MB。
Offcourse 缩小后,它大约会减少 30-35%。
然而,对于这个垃圾 Hello World 类型的应用程序来说,它仍然会超过 1 MB。以最小的方式添加引导 CSS / Jquery / Jquery UI 会进一步增加根据 Web 应用程序类型添加图像。
问题是 1.75 MB 的脚本,而无需编写与应用程序相关的任何代码行。
这是使页面大小平均超过 4-5 MB 的新 Web 标准吗?
我正在使用此代码:
{{today | date:'General.dateFormat | translate'}}
Run Code Online (Sandbox Code Playgroud)
哪里General.dateFormat是MM.dd.yyyy存储在我的语言JSON文件中的格式.但它印刷为5 22, 2017 AenerPMl.22PMteFor35PMt | trPMn24lPMte
我认为多管道存在问题.如果我General.dateFormat | translate用MM.dd.yyyy它替换它应该工作.如何使用translate管道从我的语言json文件中提供格式?
我打开我的 SSMS 并右键单击 DB,然后Tasks -> IMport Data从源导入数据,但是一旦单击,我就会收到此错误:
Failed to find or load the registered .Net Framework Data Provider. (System.Data)
Run Code Online (Sandbox Code Playgroud)
这是完整的错误:
===================================
This wizard will close because it encountered the following error: (Microsoft SQL Server)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=13.0.2164.0&EvtSrc=Microsoft.SqlServer.Management.UI.WizardFrameworkErrorSR&EvtID=UncaughtException&LinkId=20476
===================================
Exception has been thrown by the target of an invocation. (mscorlib)
------------------------------
Program Location:
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] …Run Code Online (Sandbox Code Playgroud) 这是我的代码:
<template>
<div>
<div v-html="data"></div> <button v-on:click="replace">Click Me to replace div contents</button>
</div>
</template>
<script>
export default {
data() {
return {
data: "I will be replaced once you click on button"
}
},
methods: {
clickMe() {
alert("worked");
},
replace(){
this.data = "Why does click me not work? It is loaded from server via ajax <a href v-on:click.prevent='clickMe'>Click Me</a>";
}
}
};
</script>
Run Code Online (Sandbox Code Playgroud)
在这里,如果我单击Click Me to replace div contents内容将被替换,但是事件处理程序clickMe不会触发。这些数据将来自服务器,我需要编译该字符串并在Vue的上下文中使用它,以便Vue可以处理事件等。
如何从服务器上下载动态字符串?我正在使用Vue 2。
根据Ionic文档,我可以使用以下代码加载Ionic LoadingController:
ionViewLoaded() {
let loader = this.loading.create({
content: 'Getting latest entries...',
});
loader.present().then(() => {
this.someService.getLatestEntries()
.subscribe(res => {
this.latestEntries = res;
loader.dismiss();
});
});
}
Run Code Online (Sandbox Code Playgroud)
如果我只是发出1个ajax请求,这样可以正常工作.但我有5个要求,如果我隐藏/显示加载控制器这样会导致屏幕闪烁.
有没有办法可以呈现loadingController,但dismiss()只有当所有的Ajax请求都已完成时?
EDIT:请求不依赖于彼此.他们是独立的.我正在寻找的是一种在所有可观察的请求完成时得到通知的方法.这样,当所有这些都完成时,我可以解除LoadingController.
我是 Amazon S3 的新手。我想将我所有的图像/PDF 上传到 S3,并让用户使用 URL 访问这些图像。我正在阅读文档并登陆此页面:
http://docs.aws.amazon.com/AmazonS3/latest/dev/UploadObjSingleOpNET.html
此示例仅上传图像。我如何获取上传图像的 URL,以便我可以将它们存储在我的数据库中,我的用户可以使用它们来查看图像?
例如。它不应该提供一些类似的网址http://aws.amazon.com/bucket-name/image-name.jpg,然后我可以在浏览器中输入该网址并查看我从亚马逊上传的图片。
任何帮助表示赞赏。
我有以下代码:
computed: {
mapState(["appErrors", "user", "profilesFor"]),
compiledData () {
return {
template: `<p>${this.data}</p>`
}
}
}
Run Code Online (Sandbox Code Playgroud)
基本上我正在使用Vuex,它具有mapState,但我也想定义自己的计算函数,所以我更改了
computed: mapState(["appErrors", "user", "profilesFor"])- 作品
至
computed: {
mapState(["appErrors", "user", "profilesFor"]),
compiledData () {
return {
template: `<p>${this.data}</p>`
}
}
}
Run Code Online (Sandbox Code Playgroud)
但这是行不通的。我该如何解决这个问题?