我正在研究 PrimeNG 组件。但是我在 Web 浏览器上的 UI 显示有问题。
现在,我想显示静态下拉列表。我参考了PrimeNG。以下代码用于显示该组件。
HTML文件
<h3 class="first">Single</h3>
<p-dropdown [options]="cities" [(ngModel)]="selectedCity" placeholder="Select a City"></p-dropdown>
<p>Selected City: {{selectedCity ? selectedCity.name : 'none'}}</p>
Run Code Online (Sandbox Code Playgroud)
组件文件
import { Component, OnInit } from '@angular/core';
import { SelectItem } from 'primeng/primeng';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
cities: SelectItem[];
selectedCity: string;
constructor() {
this.cities = [];
this.cities.push({ label: 'Select City', value: null });
this.cities.push({ label: 'New York', value: { id: 1, name: 'New …
Run Code Online (Sandbox Code Playgroud) 我目前有一个项目,其中有一个 angular 工作区,我在其中创建了一个 angular web 应用程序。现在我还需要一个应用程序并创建了一个 angular ionic 应用程序。我想重用我现有的使用 AngularFireauth 和 AngularFirestore 的身份验证服务,所以我创建了一个库并提取了该服务。在 angular Web 应用程序中使用库中的服务时,一切正常。但是尝试在 ionic 应用程序的页面中注入服务时,我收到错误消息 inject() 必须从注入上下文中调用。当将服务从库移动到离子应用程序并从那里使用它时,它可以工作。
离子 v.5.0.5
角度 v.9.0.6
也许有人有想法。
谢谢你的帮助!
在反应中,我使用功能组件,并且有两个函数(getBooks)和(loadMore)
getBooks
从端点获取数据。但是,当我loadMore
在函数内单击按钮调用getBooks
函数(loadMoreClicked)时,即使在延迟(5秒)调用它之后,它也不会更改它使用以前的状态。但是当我loadMore
再次打电话时,状态发生了变化,一切正常。
有人可以解释为什么初始调用 (getBooks) 时的 (loadMoreClicked) 即使在 5 秒延迟后调用它也没有更新。
function component() {
const [loadMoreClicked, setLoadMore] = useState(false);
const getBooks = () => {
const endPoint = `http://localhost/getBooks`; //this is my end point
axios
.get(endPoint, {
params: newFilters
})
.then(res => {
console.log(loadMoreClicked); //the (loadMoreClicked) value is still (false) after (5 sec)
})
.catch(err => {
console.log(err);
});
};
const loadMore = () => {
setLoadMore(true); //here i am changing (loadMoreClicked) value to (true) …
Run Code Online (Sandbox Code Playgroud) 我无法从 GitLab 上的存储库中提取新更改,因为我收到以下错误:
Cloning into 'X'...
remote: Enumerating objects: 450, done.
remote: Counting objects: 100% (331/331), done.
remote: Compressing objects: 100% (215/215), done.
remote: Total 450 (delta 145), reused 280 (delta 108), pack-reused 119 eceiving objects: 100% (450/450), 20.83 MiB | 20.82 MiB/s
Receiving objects: 100% (450/450), 26.61 MiB | 20.89 MiB/s, done.
Resolving deltas: 100% (158/158), done.
error: invalid path '\'
fatal: unable to checkout working tree
Run Code Online (Sandbox Code Playgroud)
根据这个问题,我已经尝试过git config core.protectNTFS false
,但没有任何改变。然后我尝试git config --system core.longpaths …