我试图将配置数据传递到Angular中的自定义库.
在用户应用程序中,他们将使用一些配置数据传递给我的库forRoot
// Import custom library
import { SampleModule, SampleService } from 'custom-library';
...
// User provides their config
const CustomConfig = {
url: 'some_value',
key: 'some_value',
secret: 'some_value',
API: 'some_value'
version: 'some_value'
};
@NgModule({
declarations: [...],
imports: [
// User config passed in here
SampleModule.forRoot(CustomConfig),
...
],
providers: [
SampleService
]
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)
在我的自定义库中,特别是index.ts,我可以访问配置数据:
import { NgModule, ModuleWithProviders } from '@angular/core';
import { SampleService } from './src/sample.service';
...
@NgModule({
imports: [ …Run Code Online (Sandbox Code Playgroud) 我正在使用Angular 4,我想将一些对象传递给路由器但不更新查询参数.
user.component.ts
this.router.navigate(["/profile",{
action: 'edit',
user: {id: 1, name: 'test', email: 'test@mail.com'}
}]);
Run Code Online (Sandbox Code Playgroud)
APP-routing.module.ts
{ path: 'profile', component: UserProfileComponent }
Run Code Online (Sandbox Code Playgroud)
用户profile.component.ts
this.route.params.subscribe(params => {
});
Run Code Online (Sandbox Code Playgroud)
有帮助吗?
完成后我需要发送回调ng-repeat,但我的解决方案不起作用。在我的最后一个解决方案中,我使用了一个指令来做到这一点。
标记:
<div class="results" ng-model="results">
<div class="empl-card" ng-repeat="empl in employees | filter: searchQuery" callback-on-end="alert('callback')">
...
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
指示:
app.directive("callbackOnEnd", function() {
return {
restrict: "A",
link: function(scope, element, attrs) {
if (scope.$last) {
scope.$eval(attrs.callbackOnEnd);
}
}
};
});
Run Code Online (Sandbox Code Playgroud)
我哪里可能犯了错误?
我们的团队正在使用 AWS Lambda 函数和 API 网关来促进与欧洲开放银行 API 的连接。(PSD2)。
我们的 Lambda 是用 NodeJS 编写的。
PSD2 需要相互 TLS,这很好,我们已经在沙盒环境中正确实现和工作。
示例请求如下所示:
{
hostname: '[bank hostname]',
path: '[bank api endpoint]',
method: 'GET',
headers: {
accept: 'application/json',
signature: 'XXX',
date: 'XXX',
digest: 'XXX',
'x-request-id': 'XXX',
'tpp-signature-certificate': '[PATH_TO_CERTIFICATE]',
authorization: 'Bearer [accessToken]',
},
cert: fs.readFileSync('/var/task/certs/cert.crt'), // Buffer
key: fs.readFileSync('/var/task/certs/private.key'), // Buffer
}
Run Code Online (Sandbox Code Playgroud)
我们目前遇到的问题是我们不确定在哪里安全地存储我们的证书。目前,我们只是将它们存储在我们代码库中的资产文件夹中,这并不理想,出于显而易见的原因,我们希望将它们移出我们的代码库。
我们一直在研究 AWS ACM。但是,尚不清楚我们将如何检索证书的路径(在上传证书后)以便在上述请求中使用它。
所以我的问题是我们将如何使用 AWS 安全地存储我们的证书,以便我们可以在 HTTPS 请求中使用它们?
试图uglify js文件.当我使用的包文件index.html.我得到以下错误.
下面是我的gulp文件.
'use-strict'
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var exec = require('gulp-exec');
var ngAnnotate = require('gulp-ng-annotate');
const babel = require('gulp-babel');
var exec = require('child_process').exec;
gulp.task('scripts', function () {
return gulp.src(['vzrth.js','psrhs.js'])
.pipe(ngAnnotate())
.pipe(babel({
presets: ['es2015']
}))
.pipe(concat('bundle.js'))
.pipe(uglify().on('error', function (e) {
console.log(e);
}))
.pipe(gulp.dest('./client'));
});
gulp.task('nodestart', function (cb) {
exec('node ./bin/www', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
cb(err);
});
})
gulp.task('default', ['scripts', 'nodestart']);
Run Code Online (Sandbox Code Playgroud)
我得到的错误是:
引用错误:未捕获错误:[$ injector:modulerr] http://errors.angularjs.org/1.5.8/ $ injector/modulerr?p0 = …
我成功地使菜单出现了mouseenter.我现在要做的是让它mouseleave在菜单本身的事件中消失.有关如何实现这一目标的任何想法?
<button mat-button [mat-menu-trigger-for]="menu"
#menuTrigger="matMenuTrigger" (mouseenter)="menuTrigger.openMenu()">
TRIGGER BUTTON
</button>
<mat-menu #menu="matMenu" [overlapTrigger]="false"
(mouseleave)="menuTrigger.closeMenu()">
<button mat-menu-item [routerLink]="['sources']">
<mat-icon>view_headline</mat-icon>
MENU CHOICE
</button>
</mat-menu>
Run Code Online (Sandbox Code Playgroud) 首先,这是我的例子:http://jsfiddle.net/Kn4PW/4/
我有2个图表.一个有列,一个有线.我想要的是当我点击第一张图表的一列时,可以在第二张图表上添加一个系列.
在我的示例中,当我单击列时,系列会添加到第二个图表的配置中,但图表不会重绘.我们可以看到,因为当我点击按钮添加系列时,会出现所有系列并重新绘制图形.
我的问题是,当我从柱形图中发射事件时他不是为什么不是这样做的?
谢谢
//See: https://github.com/pablojim/highcharts-ng
var myapp = angular.module('myapp', ["highcharts-ng"]);
myapp.controller('myctrl', function ($scope) {
$scope.addSeries = function () {
var rnd = []
for (var i = 0; i < 10; i++) {
rnd.push(Math.floor(Math.random() * 20) + 1)
}
$scope.highchartsNG.series.push({
data: rnd
})
}
$scope.highchartsNG = {
options: {
chart: {
type: 'line',
events: {
redraw: function() {
alert ('The chart is being redrawn');
}
}
}
},
series: [{
data: [10, 15, 12, 8, …Run Code Online (Sandbox Code Playgroud) 任何人都可以解释为什么这个查询不起作用?我想排除用主页标记的帖子.它仍显示类别名称为"主页"的帖子...
<?php
$query = new WP_Query( 'category_name=-homepage');
?>
<?php if ( $query->have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
get_template_part( 'content', 'news' );
?>
<?php endwhile; ?>
<?php the_posts_navigation(); ?>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
Run Code Online (Sandbox Code Playgroud) 我使用的是离子3,因此是角度和打字稿。
我想要实现的是将ngFor与Map类型结合使用。
这是我所拥有的:
interface IShared_Position {
lat: number;
lng: number;
time: number;
color?: string;
}
public shared_position = new Map<string, IShared_Position>();
Run Code Online (Sandbox Code Playgroud)
现在从html方面,我有:
<ion-list>
<ion-item ion-item *ngFor="let item of shared_position">
<h2>{{ item.time }}</h2>
</ion-item>
Run Code Online (Sandbox Code Playgroud)
现在,这给了我以下错误:
错误:找不到类型为“对象”的其他支持对象“ [对象图]”。NgFor仅支持绑定到Iterables,例如数组。
现在有什么可能的方法,即使它不是可迭代的,我也无法绑定我的地图?
我该怎么办?
angular ×4
angularjs ×3
javascript ×2
typescript ×2
angular2-aot ×1
aws-lambda ×1
charts ×1
gulp ×1
gulp-concat ×1
gulp-uglify ×1
highcharts ×1
iterable ×1
ngfor ×1
node.js ×1
php ×1
psd2 ×1
redraw ×1
wordpress ×1
wp-query ×1