我创建了一个有角度的网站,其中包含一个"添加"和一个"删除"表单来操作同一页面上的表格上的数据.
当我在本地或使用Chrome Dev Console(禁用缓存)进行测试时,当我添加新项目或删除新项目时,该表格会自动刷新.当我在客户端的生产服务器(IIS服务器)上测试它时,它仅适用于打开的Chrome开发者控制台.否则,他们必须使用CTRL + F5刷新缓存并在页面上显示更改.
这是组件上的代码:
addProduct() {
this._productsService.addProduct(this.addFormProductItem)
.subscribe(v => {
this._productsService.getProducts().subscribe(
products => {this.products = products, this.onChangeTable(this.config)}
);
});
this.addmodalWindow.hide();
return;
}
onChangeTable(config: any, page: any = {
page: this.page,
itemsPerPage: this.itemsPerPage
}): any {
if (config.filtering) {
Object.assign(this.config.filtering, config.filtering);
}
if (config.sorting) {
Object.assign(this.config.sorting, config.sorting);
}
this.ng2TableData = this.products;
this.length = this.ng2TableData.length;
let filteredData = this.changeFilter(this.ng2TableData, this.config);
let sortedData = this.changeSort(filteredData, this.config);
this.rows = page && config.paging ? this.changePage(page, sortedData) : sortedData;
this.length = sortedData.length;
} …Run Code Online (Sandbox Code Playgroud) 我使用了Vue.js的官方Webpack模板.它针对不同的环境使用单独的配置.他们提供测试,开发和生产.但是,我需要另一个,因为我们有两个生产服务器(一个生产和一个临时).
为不同的生产环境提供不同配置的最佳做法是什么?我会想到类似的东西npm run build --URL:http://some-url.com --PORT:80 ....
欢迎任何建议!
我一直在互联网上关于React的动态路由.但我找不到任何解释它如何工作的东西,以及它与每种意义上的静态路由有何不同.
当我们想要使用React-Route在同一页面中呈现某些内容时,我非常理解这些事情.
我的问题是,当想要呈现整个新页面时,它是如何工作的?因为在这种情况下,必须重新呈现该页面内的所有DOM.那么这是静态路由吗?或者在某些方面仍然充满活力?
我希望我已经清楚了.感谢您提前的答案,我感谢!
出于某种原因,我被这个"东西"困住了
如您所见,我想尝试读取count.txt.这是完美的,但由于某种原因
alert(code);
Run Code Online (Sandbox Code Playgroud)
快到了之后的
alert("The number can't be smaler then 0");
Run Code Online (Sandbox Code Playgroud)
对我来说没有任何意义,因为我在警报之前调用警报(计数)("数字......")任何想法为什么在另一个警报之后调用jQuery函数(警报)?
function leftFunction() {
jQuery.get('count.txt', function(data) {
var count = data;
alert(count);
});
scrolling = true;
if(number == 0) {
alert("The number can't be smaler then 0");
return;
}
number--;
document.getElementById("myImage").src = "latest" + number + ".jpg";
}
Run Code Online (Sandbox Code Playgroud) 我有一个基于字符串的枚举.在不更改枚举类的情况下,我需要在模态上显示不同的字符串.我的obj包含枚举.我的代码如下:
ENUM:
export enum FooEnum {
ONE,
TWO,
THREE
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<select class="form-control"
type="text"
id="foo"
[(ngModel)]="obj.foo"
required
name="foo"
#foo="ngModel">
<option *ngFor="let foo of fooToList()" [ngValue]="foo">{{foo}}</option>
</select>
Run Code Online (Sandbox Code Playgroud)
打字稿:
fooToList(): Array<string> {
const keys = Object.keys(FooEnum);
return keys.slice(keys.length / 2);
}
Run Code Online (Sandbox Code Playgroud)
我想将ONE视为Un,TWO视为Deux等.你能帮我一下吗?
注意:我还包括角度2,因为2和4非常相似.
我正在学习如何使用 angular 的新 http 客户端模块。当我尝试使用其余 api 时,我收到错误无法读取未定义的属性“数据”。这是我的 app.html,
<div style="text-align:center">
<h1>
Welcome to {{title}}!
</h1>
<button (click)="getPosts()">Get Posts</button>
<div *ngFor="let result of results.data">
{{ result | json }}
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
这是我的 app.component.ts
import { Component, OnInit } from '@angular/core';
import {HttpClient} from '@angular/common/http';
interface ItemsResponse {
data: any[];
}
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
results: any;
// Inject HttpClient into your component or service.
constructor(private http: HttpClient) {}
title = 'School2College'; …Run Code Online (Sandbox Code Playgroud) 我试图找到一种google chrome在 CentOS 6.9 中安装的方法。
有人说谷歌已经停止支持,其他人有不同的方法来做。
但是他们的解决方案对我没有帮助。
有谁知道如何做到这一点?