小编pri*_*ime的帖子

Angular/4 - Route动画不起作用

我正在尝试使用Angular/4在Angular CLI项目中实现路由动画.我一直在努力学习教程,但成效有限.

我的代码读了

/src/app/_animations/fadein.animation.ts

import { trigger, state, animate, transition, style } from '@angular/animations';

export const fadeInAnimation =
// trigger name for attaching this animation to an element using the 
[@triggerName] syntax
    trigger('fadeInAnimation', [

        // route 'enter' transition
        transition(':enter', [
         // css styles at start of transition
        style({ opacity: 0 }),
         // animation and styles at end of transition
        animate('3000ms', style({ opacity: 1 }))
    ]),
]);
Run Code Online (Sandbox Code Playgroud)

/src/app/dashboard/dashboard.component.ts

import { Component, OnInit } from '@angular/core';
import { SlimLoadingBarService } …
Run Code Online (Sandbox Code Playgroud)

animation angular

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

无法使自定义存储库正常工作

我正在关注Symfony2教程(第4章),但是我无法getLatestBlogs从自定义存储库中检索该方法.

我在Linux Mint上使用Symfony 2.2和Phar.

我自己创建了存储库,但我很难过.我收到此错误:

未定义的方法'getLatestBlogs'.方法名称必须以findBy或findOneBy开头! - BadMethodCallException

我搜索了其他类似的问题,但无济于事.任何人都可以在我的代码中发现错误吗?

附加信息

我的composer.json内容如下:

"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.2.0", ** NOTE : Originally read 2.2.* but I changed and successfully ran a composer update **
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.2.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.1.*",
    "symfony/swiftmailer-bundle": "2.2.*",
    "symfony/monolog-bundle": "2.2.*",
    "sensio/distribution-bundle": "2.2.*",
    "sensio/framework-extra-bundle": "2.2.*",
    "sensio/generator-bundle": "2.2.*",
    "jms/security-extra-bundle": "1.4.*",
    "jms/di-extra-bundle": "1.3.*",
    "doctrine/doctrine-fixtures-bundle": "dev-master",
    "doctrine/data-fixtures" : "dev-master"        
},
Run Code Online (Sandbox Code Playgroud)

我的src/Blogger/BlogBundle/Controller/PageController.php:

namespace Blogger\BlogBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Blogger\BlogBundle\Entity\Enquiry;
use Blogger\BlogBundle\Form\EnquiryType;

class PageController extends Controller
{ …
Run Code Online (Sandbox Code Playgroud)

symfony doctrine-orm

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

Typescript编译器突然开始生成错误

我正在开发一个Angular 2项目,突然间,当我尝试运行typescript编译器时,我开始遇到很多错误.有人可以建议从哪里开始搜索?我并没有故意改变任何基本的东西,即使我从存储库中克隆了一个新的副本,错误仍然存​​在.错误如下:

node_modules/@types/node/index.d.ts(102,6): error TS2300: Duplicate identifier 'BufferEncoding'.
node_modules/@types/node/index.d.ts(256,9): error TS2403: Subsequent variable declarations must have the same type.  Variable 'errno' must be of type 'number', but here has type 'string'.
node_modules/@types/node/index.d.ts(263,18): error TS2300: Duplicate identifier 'EventEmitter'.
node_modules/@types/node/index.d.ts(549,26): error TS2300: Duplicate identifier 'Buffer'.
node_modules/@types/node/index.d.ts(549,50): error TS2300: Duplicate identifier 'SlowBuffer'.
node_modules/@types/node/index.d.ts(570,18): error TS2300: Duplicate identifier 'EventEmitter'.
node_modules/@types/node/index.d.ts(570,18): error TS2415: Class 'EventEmitter' incorrectly extends base class 'NodeJS.EventEmitter'.
  Types of property 'eventNames' are incompatible.
    Type '() => (string | symbol)[]' is not assignable …
Run Code Online (Sandbox Code Playgroud)

node.js angular

7
推荐指数
1
解决办法
5171
查看次数

是否可以在没有SauceLabs的情况下使用带有Github/Travis CI的量角器

我已经签署了Travis CI的私人存储库.我目前的所有测试都是基于PHP的,但我希望使用量角器测试我的Angular/2 CLI前端解决方案.我一直在谷歌上搜索,并继续看到"Saucelabs"作为一个额外的工具.

我是否需要注册saucelabs或其他第三方提供商才能使用github/travis运行量角器?对于新手来说,任何对白痴友好的文章?

非常感谢.

protractor angular

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

Angular 模块导入的范围是什么

如果我有三个模块

  1. 应用程序模块
  2. 共享模块
  3. 项目模块

在 SharedModule 内部,我有一个 PaginatorComponent,导出如下:

共享模块.ts

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { PaginatorComponent } from './paginator/paginator.component';

@NgModule({
  imports: [
      CommonModule
  ],
  declarations: [
      PaginatorComponent
  ],
  providers: [],
  exports: [
      PaginatorComponent
  ]
})
export class SharedModule { }
Run Code Online (Sandbox Code Playgroud)

然后,我使用以下行将共享模块导入到我的 AppModule 中

应用程序模块.ts

import { SharedModule } from './shared/shared.module';

imports: [
      ...
      SharedModule,
      ...
Run Code Online (Sandbox Code Playgroud)

问题; 我的第三个“ItemModule”应该自动访问 PaginatorComponent 还是需要直接导入到第三个模块中?目前我得到了一般错误的变体:

Can't bind to 'totalItems' since it isn't a known property of 'app-paginator'.
1. …
Run Code Online (Sandbox Code Playgroud)

angular

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

从minikube集群内部连接到本地数据库

我正在尝试从minikube pod内部访问托管在localhost的docker容器内的MySQL数据库,但收效甚微。我尝试了描述的解决方案,Minikube将在本地主机上运行的MySQL作为服务公开,但没有任何效果。我已经在我们在AWS上使用的服务上对我的解决方案建模,但是它似乎不适用于minikube。我的服务内容如下

apiVersion: v1

kind: Service

metadata: 

  name: mysql-db-svc

  namespace: external

spec: 
  type: ExternalName
  ExternalName: 172.17.0.2
Run Code Online (Sandbox Code Playgroud)

...我尝试使用端口3306上的“ mysql-db-svc”从pod内部连接到数据库,但无济于事。如果尝试从Pod内对地址“ mysql-db-svc”进行CURL处理,它将无法解析主机名。

有人可以建议沮丧的新手吗?

kubernetes minikube

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

Sequelize - 使用 MySQL 选择所有超过 5 分钟的记录的抽象查询

我正在努力使用sequelize 编写一个抽象查询,该查询将使用“updatedAt”列识别超过5 分钟的记录。我的查询如下:

const Jts = await models.Jts.findOne({
    where: {
        publish: true,
        retry: {
            [Op.lte]: 3
        },
        updatedAt: {
            [Op.lte]: [sequelize.fn("(NOW() - INTERVAL 5 MINUTE)")]
        }
    },
    include: ["OrgSetEntries"],
    paranoid: false,
    order: [
        ["effectiveDate", "ASC"],
        ["updatedAt", "ASC"]
    ]
});
Run Code Online (Sandbox Code Playgroud)

我尝试了一些语法,但很挣扎。生成的查询始终生成“无效日期”字符串,例如:

... updatedAt` &lt;= 'Invalid date';
Run Code Online (Sandbox Code Playgroud)

任何意见是极大的赞赏。

javascript mysql orm node.js sequelize.js

4
推荐指数
1
解决办法
3426
查看次数

DynamoDB - 通过 GSI (PHP) 更新项目

我正在尝试使用全局二级索引更新项目。下面列出了我的表定义。我是 DynamoDb 的新手。

    $response = $this->client->createTable([
        'TableName' => 'rawproducts_products',
        'AttributeDefinitions' => [
            [
                'AttributeName' => 'product_code',
                'AttributeType' => 'N'
            ],
            [
                'AttributeName' => 'token',
                'AttributeType' => 'S'
            ],
            [
                'AttributeName' => 'processed_at',
                'AttributeType' => 'N'
            ],
            [
                'AttributeName' => 'created_at',
                'AttributeType' => 'N'
            ]                    
        ],
        'KeySchema' => [
            [
                'AttributeName' => 'product_code',
                'KeyType' => 'HASH' 
            ],
            [
                'AttributeName' => 'token',
                'KeyType' => 'RANGE' 
            ]
        ],
        'LocalSecondaryIndexes' => [
            [
                'IndexName' => 'ProductCodeProcessedIndex',
                'KeySchema' => [
                    ['AttributeName' => 'product_code', 'KeyType' => …
Run Code Online (Sandbox Code Playgroud)

amazon-dynamodb

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

Angular/2 | 过滤异步流

我正在使用异步管道将数据传递给子组件,但我希望通过"mimetype"的值过滤数据.但是,当我添加我的过滤器时,我不会选择添加到流中的任何新对象.例如; 以下工作完美

<asset-list [assets]="assets$ | async"></asset-list>
Run Code Online (Sandbox Code Playgroud)

在子组件内部,我循环遍历资源以显示列表.但是,如果我添加我的过滤管道,例如

<asset-list [assets]="assets$ | async | imageFilter"></asset-list>
Run Code Online (Sandbox Code Playgroud)

我不再接受对流的任何更改.我的管道内容如下:

import { Injectable, Pipe, PipeTransform } from '@angular/core';

@Pipe({
    name: 'imageFilter'
})
@Injectable()
export class AssetImagesPipe implements PipeTransform {

    transform(assets: any[] ) {

        var images = [];

        for( let i in assets ) {

            if( assets[i].mimetype.substring(0,5) == 'image' )
            {
                images.push( assets[i] );
            }
        }

        return images;
    }
}
Run Code Online (Sandbox Code Playgroud)

任何意见是极大的赞赏.

angular

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

DynamoDb - Integer无法转换为String

我是dynamoDB的新手,我正在努力填充我的DynamoDB表,我已经按如下方式定义了表:

    $response = $DynamoDb->createTable([
        'TableName' => 'products',
        'AttributeDefinitions' => [
            [
                'AttributeName' => 'product_code',
                'AttributeType' => 'N'
            ],
            [
                'AttributeName' => 'created_at',
                'AttributeType' => 'N'
            ],
        ],
        'KeySchema' => [
            [
                'AttributeName' => 'product_code',
                'KeyType' => 'HASH' 
            ],
            [
                'AttributeName' => 'created_at',
                'KeyType' => 'RANGE' 
            ]
        ],
        'ProvisionedThroughput' => [
            'ReadCapacityUnits'    => 5,
            'WriteCapacityUnits' => 6
        ]
    ]);
Run Code Online (Sandbox Code Playgroud)

并填充使用

    $result = $DynamoDb->putItem([
      'TableName' => 'products',
        'Item' => [
          'product_code' => ['N'  =>  (int)$row[0]],
          'created_at' => ['N' => (int)strtotime("now")]
        ]
    ]); …
Run Code Online (Sandbox Code Playgroud)

amazon-dynamodb

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

Angular 6 功能模块:拦截器不触发

我是第一次使用功能模块,无法触发拦截器。我是特征模型模式的新手,希望有人能指出我理解中的一个明显错误。拦截器称为“AuthenticationInterceptor”。我已经在下面粘贴了我的代码,非常感谢任何帮助。

我的代码库的结构如下:

/应用程序

app.module.ts
...
/dashboard
    dashboard.module.ts
    dashboard-routing.module.ts
    dashboard.component.ts
    ...
/core
    core.module.ts
    ...
/shared
    shared.module.ts
    ....
Run Code Online (Sandbox Code Playgroud)

应用模块.TS

import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { CoreModule } from './core/core.module'
import { SharedModule } from './shared/shared.module'
import { DashboardModule } from './dashboard/dashboard.module'

import { AppComponent } from './app.component';

import { AuthenticationInterceptor } from './core/interceptors/authentication.interceptor'

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule, …
Run Code Online (Sandbox Code Playgroud)

angular

0
推荐指数
1
解决办法
2147
查看次数