我想显示来自ViewModel
.
问题:名称DisplayAlert
在当前上下文中不存在
怎么做?下面是我的代码。
-- XAML
<Button x:Name="BtnLogin" Command="{Binding LoginCommand}" BackgroundColor="Green" TextColor="White" WidthRequest="150" HeightRequest="60" Text="Login" />
--- ViewModel :
class LoginViewModel : ViewModelBase
{
private string _username;
public string Username
{
get { return _username; }
set
{
_username = value;
OnPropertyChanged();
}
}
private string _password;
public string Password
{
get { return _password; }
set
{
_password = value;
OnPropertyChanged();
}
}
public LoginViewModel()
{
}
public Command LoginCommand
{
get
{
return new Command(ValidateUser); …
Run Code Online (Sandbox Code Playgroud) 我正在按照本教程关于如何将angular与firebase数据库连接起来.但是在第17:30分钟,我收到了这个错误:
'AngularFireList <{}>'类型中不存在属性'subscribe'
我的AppComponent:
import { Component } from '@angular/core';
import {AngularFireDatabase, AngularFireDatabaseModule} from 'angularfire2/database';
import {AngularFireAuth, AngularFireAuthModule} from 'angularfire2/auth';
import { Observable } from 'rxjs/Observable';
import * as firebase from 'firebase/app';
import { Country } from './models/country';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
countries: any[];
constructor(db: AngularFireDatabase )
{
db.list('/Country/countries')
.subscribe(countries => { // <--ERROR IS HERE
this.countries = countries;
console.log(this.countries);
});
}
}
Run Code Online (Sandbox Code Playgroud)
我的模特:
export class Country {
// --ATTRIB-- …
Run Code Online (Sandbox Code Playgroud) firebase firebase-realtime-database angular-cli angularfire2
我正在尝试启动并运行地图 API,并努力使 Blazor 与 Js 函数配合使用。有没有人有 Bing 或 Google 地图在 Blazor 中工作的例子,我可以看看?
我已经尝试使用 Microsoft 的 Blazor JSInterop 文档中描述的方法引用存储在 wwwroot.index.html 文件中的脚本,但大多都失败了。
索引.html:
<body>
<app>Loading...</app>
<script type='text/javascript'>
function loadMapScenario() {
var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {});
var pushpin = new Microsoft.Maps.Pushpin(map.getCenter(), null);
map.entities.push(pushpin);
return "";
}
</script>
<script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?key=###&callback=loadMapScenario' async defer></script>
<script src="_framework/blazor.webassembly.js"></script>
</body>
Run Code Online (Sandbox Code Playgroud)
blazor 页面:
@page "/"
@inject IJSRuntime JSRuntime
<h1>Hello, world!</h1>
Welcome to your new app.
<div id='myMap' style='width: 400px; height: 300px;'></div>
@functions {
protected override async Task OnInitAsync() …
Run Code Online (Sandbox Code Playgroud) 我有一个关于在angularfire 的firestore中插入对象的问题:
我的对象 Person.ts
name: String
age: Number
//--constructor--
//--getters and setters--
Run Code Online (Sandbox Code Playgroud)
如果我这样做,请插入:(但这是一个好习惯吗?)
[person.component.ts]
this.db.collection("person").add({
name: this.person.$nome,
age: this.person.$email
})
...
Run Code Online (Sandbox Code Playgroud)
但如果我尝试:
[person.component.ts]
this.db.collection("person").add({
Person: this.person
//or this this.person
})
Run Code Online (Sandbox Code Playgroud)
我在浏览器控制台中收到此错误:
使用无效数据调用函数 DocumentReference.set()。不支持的字段值:在 new FirestoreError (error.js:149) 处的自定义 Person 对象(在字段 Person 中找到)
angularjs firebase-realtime-database google-cloud-firestore angularfire5
我已经通过添加最新的包引用来安装该包。来自https://www.nuget.org/packages/Microsoft.AspNetCore.Blazor.HttpClient/
但我仍然无法找到所需的功能,如..Client.GetJsonAsync
如果我遗漏了什么,你能帮我吗? 谢谢。
我在这里尝试但不能。
public async Task<User> GetUser(string Id)
{
HttpClient client = new HttpClient();
var user = await client.GetJsonAsync($"{BaseUrl}Get-User/{Id}");
return JsonConvert.DeserializeObject<User>(user);
}
Run Code Online (Sandbox Code Playgroud) 我想在模板中的标签中调用模型方法 get_url()
模型.py
class Department(Base):
department_name = models.CharField(max_length=128)
description = models.TextField(null=True, blank=True)
def get_url(self):
ct = ContentType.objects.get(model='department')
url_name = ' %s:%s ' % (ct.app_label, ct.model)
return reverse(url_name, args=(self.object_id))
Run Code Online (Sandbox Code Playgroud)
模板.html
<a href="{% ? ... how to call the model method here.... ? %}"></a>
Run Code Online (Sandbox Code Playgroud) blazor ×2
angular-cli ×1
angularfire2 ×1
angularfire5 ×1
angularjs ×1
asp.net-core ×1
c# ×1
django ×1
firebase ×1