我正在尝试测试angular2双向绑定以进行控制input.这是错误:
Can't bind to 'ngModel' since it isn't a known property of 'input'.
Run Code Online (Sandbox Code Playgroud)
app.component.html
<input id="name" type="text" [(ngModel)]="name" />
<div id="divName">{{name}}</div>
Run Code Online (Sandbox Code Playgroud)
app.component.ts
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {
name: string;
}
Run Code Online (Sandbox Code Playgroud)
app.component.spec.ts
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { AppService } from './app.service';
describe('App: Cli', () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
providers:[AppService]
});
});
it('divName', async(() => {
let …Run Code Online (Sandbox Code Playgroud) 我将通过https://angular.io/docs/ts/latest/tutorial/toh-pt5.html上的Angular2教程 .一切顺利的路由.Visual Studio代码显示前03行的错误:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
Run Code Online (Sandbox Code Playgroud)
如
[ts]
Module '"c:/Users/ktran/Source/Repos/angular2-quickstart-ts/node_modules/@angular/core/index"' has no exported member 'NgModule'.
Run Code Online (Sandbox Code Playgroud)
文件夹node_modules:
有什么想法吗?
我正在测试从 Angular 到 Cognito 用户池的 AWS Amplify,如下所示:
https://docs.amplify.aws/lib/restapi/getting-started/q/platform/js
Angular 应用程序已成功编译,但在 Chrome 控制台中抛出异常:
index.js:43 Uncaught ReferenceError: global is not defined
at Object../node_modules/buffer/index.js (index.js:43)
at __webpack_require__ (bootstrap:84)
at Module../node_modules/amazon-cognito-identity-js/es/AuthenticationHelper.js (AuthenticationHelper.js:1)
at __webpack_require__ (bootstrap:84)
at Module../node_modules/amazon-cognito-identity-js/es/index.js (index.js:1)
at __webpack_require__ (bootstrap:84)
at Module../node_modules/@aws-amplify/auth/lib-esm/Auth.js (Auth.js:1)
at __webpack_require__ (bootstrap:84)
at Module../node_modules/@aws-amplify/auth/lib-esm/index.js (index.js:1)
at __webpack_require__ (bootstrap:84)
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?
尝试在 Nexus 5x 中运行该应用程序时出现此错误。
\n\n下面是堆栈:
\n\n04-16 22:41:37.083 23199-23199/au.com... E/AndroidRuntime: FATAL EXCEPTION: main\n Process: au.com.beewest.natswarehouse, PID: 23199\n java.lang.RuntimeException: Unable to start activity ComponentInfo{au.com.beewest.natswarehouse/au.com....MainActivity}: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout\n at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)\n at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)\n at android.app.ActivityThread.-wrap11(ActivityThread.java)\n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)\n at android.os.Handler.dispatchMessage(Handler.java:102)\n at android.os.Looper.loop(Looper.java:148)\n at android.app.ActivityThread.main(ActivityThread.java:5422)\n at java.lang.reflect.Method.invoke(Native Method)\n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)\n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)\n Caused by: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class android.support.design.widget.CoordinatorLayout\n at android.view.LayoutInflater.inflate(LayoutInflater.java:539)\n at …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 VS 2015 将 OWIN JWT 添加到 webapi 项目中。参考显示Microsoft.Owin.Security.Jwt, Version=4.0.0.0和Microsoft.IdentityModel.Tokens Version=5.3.0.0. 下面是运行时的错误。我5.2.0.0在源代码中找不到。
=== Pre-bind state information ===
LOG: DisplayName = Microsoft.IdentityModel.Tokens, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Users/xxx/Documents/xxx/WebApi/
LOG: Initial PrivatePath = C:\Users\xxx\Documents\xxx\WebApi\bin
Calling assembly : Microsoft.Owin.Security.Jwt, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
Run Code Online (Sandbox Code Playgroud)
请问有什么想法吗?
我正在尝试通过 AzureAD 使用 OAuth2 来保护 APIM API,方法是阅读以下文章:通过使用 Azure AD 的 OAuth 2.0 授权保护 Azure API 管理中的 Web API 后端
AzureAPIM - OAuth2
AzureAD - 后端应用程序:
AzureAD - 客户端应用程序:
对于演示会议 API,将验证 JWT 策略添加到入站处理,其中3a0cf09b-是租户 id,b7c31179-是后端应用程序应用程序 id:

检查 jwt.io 中收到的令牌,我发现"aud": "00000003-0000-0000-c000-000000000000"不是后端应用程序应用程序 ID:
{
"aud": "00000003-0000-0000-c000-000000000000",
"iss": "https://sts.windows.net/3a0cf09b-xxx/", …Run Code Online (Sandbox Code Playgroud) 是否可以承担iam-role1链接到Cognito 用户池中的cognito-group1Cognito 用户的Cognito 组的 IAM 角色?cognito-user1cognito-user-pool1
我的配置:
Cognito 用户池cognito-user-pool1:
cognito-user1属于cognito-group1cognito-group1已分配给iam-role1。Cognito 身份池cognito-identity-pool1:
cognito-user-pool1iam-role1我是:
iam-role1具有访问 S3 ReadOnly 的策略此代码允许我向 Cognito 用户池进行身份验证:
AmazonCognitoIdentityProviderClient provider = new AmazonCognitoIdentityProviderClient();
CognitoUserPool userPool = new CognitoUserPool("user-pool-id", "client-id", provider);
CognitoUser user = new CognitoUser("cognito-user1", "client-id", userPool, provider);
InitiateSrpAuthRequest authRequest = new InitiateSrpAuthRequest()
{
Password = "cognito-password1"
};
AuthFlowResponse authResponse …Run Code Online (Sandbox Code Playgroud) 尝试使用@azure/msal-react@1.0.0-alpha.6 和@azure/msal-browser@2.11.2 在 React 应用程序中登录重定向时出现此错误。登录数据正确返回,但在控制台中引发异常。
未捕获(承诺)BrowserAuthError:interaction_in_progress:交互正在进行中。请确保在调用交互式 API 之前已完成此交互。
import * as msal from "@azure/msal-browser";
const msalConfig = {
auth: {
clientId: '995e81d0-',
authority: 'https://login.microsoftonline.com/3a0cf09b-',
redirectUri: 'http://localhost:3000/callback'
},
cache: {
cacheLocation: "sessionStorage", // This configures where your cache will be stored
storeAuthStateInCookie: false, // Set this to "true" if you are having issues on IE11 or Edge
}
};
const msalInstance = new msal.PublicClientApplication(msalConfig);
try {
msalInstance.handleRedirectPromise()
.then(res=>{
console.log(res)
})
.catch(err => {
console.error(err);
});
var loginRequest = {
scopes: ["api://58ca819e-/access_as_user"] …Run Code Online (Sandbox Code Playgroud) 我正在删除带有数据的表中的一列xxx。DACPAC 正在生成如下检查。
IF EXISTS (select top 1 1 from [dbo].[xxx])
RAISERROR (N'Rows were detected. The schema update is terminating because data loss might occur.', 16, 127) WITH NOWAIT
Run Code Online (Sandbox Code Playgroud)
所有数据迁移均已在预部署脚本中完成。目前我已经手动注释掉了。
如何防止它自动生成?
更新后Auth0登录样品使用HashLocationStrategy在app.module.ts:
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
// (...)
@NgModule({
providers: [
{provide: LocationStrategy, useClass: HashLocationStrategy},
appRoutingProviders,
AUTH_PROVIDERS
],
//(...)
Run Code Online (Sandbox Code Playgroud)
Auth0 Lock authenticated事件不再被引发:
import { Injectable } from '@angular/core';
import { tokenNotExpired } from 'angular2-jwt';
// Avoid name not found warnings
declare var Auth0Lock: any;
@Injectable()
export class Auth0Service {
// Configure Auth0
lock = new Auth0Lock('I21EAjbbpf...', '....au.auth0.com', {});
constructor() {
// Add callback for lock `authenticated` event
this.lock.on("authenticated", (authResult) => { …Run Code Online (Sandbox Code Playgroud) Currently in the service i am calling http.get as follow
getList(): Observable<Customer[]> {
return this.http.get<Customer[]>("api/customers");
Run Code Online (Sandbox Code Playgroud)
}
in component ngOnInit the list of customer is returned:
this.customerService.getList().subscribe(data => (this.customers = data));
Run Code Online (Sandbox Code Playgroud)
It is working fine. Now i want to sorting the list before returning to the component.
any idea of how to return sorted list in the service to compnent?
D3 用于svg在angular2组件中生成 a 。如何从 svg 事件更新属性x和y组件mousemove?
export class AxisComponent implements OnInit {
x:number;
y:number;
ngOnInit() {
var svgWidth=400;
var svgHeight=400;
var margin = {top:25, right:25, bottom:50, left:50};
var width = svgWidth - margin.left - margin.right;
var height = svgHeight - margin.top - margin.bottom;
var svg = d3.select('#container').append('svg')
.attr('width', svgWidth)
.attr('height',svgHeight)
.style('border', '2px solid');
svg.on("mousemove", function(){
var xy = d3.mouse(this);
this.x = xy[0];
this.y = xy[0];
});
}
Run Code Online (Sandbox Code Playgroud)
从mousemove事件访问时出错:
angular ×6
amazon-iam ×1
android ×1
angular-cli ×1
auth0 ×1
aws-amplify ×1
c# ×1
d3.js ×1
dacpac ×1
jwt ×1
oauth-2.0 ×1
owin ×1
reactjs ×1
sql-server ×1
svg ×1
testing ×1
typescript ×1