小编use*_*415的帖子

在Ionic和Angular应用程序之间共享代码

我有一个项目,其中有多个Angular应用程序和一个离子应用程序。我有许多类(模型)以及可以在所有应用程序之间共享的服务。

我的第一个想法是将共享文件放置在它们自己的单独目录/文件夹中,并创建一个符号链接。我试图启动离子应用程序,并且收到以下消息:

模块构建失败:错误:TypeScript编译中缺少/home/norman/Work/vem-shared/shared-services/table/table.service.ts。请通过“文件”或“包含”属性确保它在您的tsconfig中。

搜索此错误消息后,我遇到了以下内容,但是,这是针对较低角度的版本(我使用的是Angular 6和Ionic 4)。我还注意到许多关于符号链接在角度cli中不起作用的帖子-似乎适用于旧版本。

我想找出是否有人知道如何解决此错误,以及符号链接在角度应用程序/离子应用程序中是否起作用?

谢谢

ionic-framework angular

10
推荐指数
1
解决办法
656
查看次数

离子4使用模态通过模态控制器

我正在使用Ionic 4并希望使用ModalController来使用模态.在Ionic 3.x中它非常简单,但我在Ionic 4中遇到了一些错误:

我正在尝试启动Modal的页面:

import { Component, OnInit } from '@angular/core';
import { NavController, NavParams, ModalController } from '@ionic/angular';
import { MyModalPage } from '../MyModalPage/MyModalPage.page';

@Component({
  selector: 'app-product-display',
  templateUrl: './product-display.page.html',
  styleUrls: ['./product-display.page.scss'],
})
export class ProductDisplayPage implements OnInit {

  private params:any = {};
  public product:product = {};

  constructor(

    public modalCtrl : ModalController
  ) { 

  }//End of Constructor

  ngOnInit() {
  }

  async openModal()
  {

    var data = { message : 'hello world' };

    const modalPage = await this.modalCtrl.create({
      component: MyModalPage, …
Run Code Online (Sandbox Code Playgroud)

modal-dialog ionic-framework angular

8
推荐指数
1
解决办法
1万
查看次数

Node Sass 找不到适合您当前环境的绑定:带有 Node.js 7.x 的 Linux 64 位

我在使用 Ionic Serve 时遇到问题,收到以下错误消息(请注意,一切正常,直到我不得不使用CTRL+终止会话C,然后它开始出现此错误:

    Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 7.x

Found bindings for the following environments:
  - Linux 64-bit with Node.js 8.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.
Run Code Online (Sandbox Code Playgroud)

为了尝试解决这个问题,我已经:

  1. 使用命令 npm重建node-sass --force
  2. 删除 node-sass 目录并运行 sudo npm install
  3. 删除整个节点模块目录并使用 sudo npm install 重新安装所有内容

任何帮助将不胜感激。根据其他帖子,对于大多数人来说,上述选项之一似乎有效。只是不适合我。

我正在运行 Linux Ubuntu,并且我还没有触及我的节点版本: …

node.js

5
推荐指数
1
解决办法
9491
查看次数

async await + toPromise挂起

我正在使用ngx-stripe,而createToken返回一个Observable,我试图将其转换为promise,以便我可以使用Async/await.然而,看起来好像没有解决.调试没有显示任何内容,我的try/Catch块没有捕获任何错误.

我想知道我是否正确使用了toPromise:

import {
    Elements,
    Element as StripeElement,
    ElementsOptions,
    BankAccountData,
    StripeService
} from 'ngx-stripe';

constructor(
    public stripeService: StripeService,

) {}



async next() {
    let token: any;
    let account: BankAccountData = {
        country: this.country,
        currency: this.currency,
        account_holder_name: this.first_name + " " + this.last_name,
        account_holder_type: this.type,
        account_number: account_number,
        routing_number: routing_number
    };

    console.log("--> Creating Bankaccount Token", account);

    try {
        token = await this.stripeService.createToken("bank_account", account).toPromise();
    } catch (excep) {
        console.log(excep);
    }

    console.log("-->Token Generated : ", token);
}
Run Code Online (Sandbox Code Playgroud)

编辑

调试器 - 如果它有帮助.这是最后一个控制台输出:

创建Bankaccount令牌{country:"AU",货币:"aud",account_holder_name:"某人姓名",account_holder_type:"个人",account_number:"000123456",...} …

stripe-payments angular

5
推荐指数
1
解决办法
866
查看次数

Firebase存储随机返回存储/取消

我收到一条错误消息,指出用户取消了上传,并且从控制台中的一次上传中收到了三个错误(上传文件时,来自Firebase存储的所有错误都相同。我看不到代码中的方式表示正在进行取消(假设由于声明了被用户取消,则它位于代码内。

  startUpload(event: FileList, item:string) {
    // The File object
    const file = event.item(0);
    console.log(item);

    // Client-side validation example
    if (file.type.split('/')[0] !== 'image') { 
      console.error('unsupported file type')
      return;
    }

    // The storage path
    const path = `test/${new Date().getTime()}_${file.name}`;

    // Totally optional metadata
    const customMetadata = { user: item };

    // The main task
    this.uploadStatus = 'inprogress';
    this.task = this.storage.upload(path, file, { customMetadata })
    const fileRef = this.storage.ref(path);

    // Progress monitoring
    this.percentage = this.task.percentageChanges();
    this.snapshot = this.task.snapshotChanges().pipe(
      tap(snap => {
        if (snap.bytesTransferred …
Run Code Online (Sandbox Code Playgroud)

javascript firebase firebase-storage

5
推荐指数
1
解决办法
389
查看次数

EF -- 无法确定类型之间关联的主要端

我无法弄清楚我在这里做错了什么。我正在使用 asp.net Identity,并且创建了一个名为Person. 我更新了ApplicationUserClass 以引用Person. 我想从创建一个导航属性PersonUser。但是当我执行更新数据库时,我不断收到错误消息

无法确定类型“myapp.Models.ApplicationUser”和“myapp.Models.DataModels.Person”之间关联的主要端。必须使用关系流畅 API 或数据注释显式配置此关联的主体端。

public class Person 
{
    public Guid ID {get; set;}
    ...
    public virtual ApplicationUser user {get; set;}
}

public class ApplicationUser
{
    ...
    public Person person {get; set;}
}
Run Code Online (Sandbox Code Playgroud)

在代码中,我正在执行以下操作

ApplicationUser user = new ApplicationUser {...} 

Person person = new Person {....} 
user.person = person;
Run Code Online (Sandbox Code Playgroud)

我还想知道是否需要为Person此类的 Virtual 属性设置任何内容person.user = user

我试图通过对虚拟属性执行以下操作来遵循无法确定类型之间关联的主要端

public class Person 
{
    public …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc entity-framework entity-framework-6

3
推荐指数
1
解决办法
6078
查看次数

Bloc to Bloc Communication Mutibloc Provider

我正在使用 flutter_bloc 并且我需要一个 bloc与另一个bloc 进行通信- 我有一个 activityBloc 需要侦听 authBloc 以确定作者是否已通过身份验证并获取用户 ID(目的是开始侦听 firestore 上的文档更改基于来自身份验证的用户 ID)。

我通过构造函数将依赖对象传递给 activityBloc。

class ActivityBloc extends Bloc<ActivityEvent, ActivityState> {
  final AuthBloc authBloc;
  final ActivityRepository repo;
  StreamSubscription authSubscription;
  StreamSubscription activitySubscription;
  String id; // userid
  int limit = 10;

  ActivityBloc({this.authBloc, this.repo}) {
    id = "";

    authSubscription = authBloc.listen((state) {
      if (state is AuthenticatedState) {
        id = state.user.uid;
        ...
          });
        });
      }
    });
  }

  @override
  ActivityState get initialState => ActivityInitial();
...
}
Run Code Online (Sandbox Code Playgroud)

我需要在 multibloc 提供程序中公开这些内容,如何在需要将一个 bloc 传递到另一个 bloc …

flutter flutter-bloc

2
推荐指数
2
解决办法
1908
查看次数