我正在努力一点一点地迁移一个大的angular.js应用程序(使用ui-router)到角度,我选择使用angular.js应用程序作为基础并一次迁移一个不同的路由,这样我曾经我完成了我立刻将所有东西切换到角度.
这些是我遵循的步骤:
在我的main.ts文件中启动angular.js应用程序:
export function bootstrapAngular(extra: StaticProvider[]): any {
setAngularJSGlobal(angular);
if (environment.production) {
enableProdMode();
}
return platformBrowserDynamic(extra)
.bootstrapModule(AppModule)
.catch(err => console.log(err));
}
const downgraded = angular
.module('downgraded', [downgradeModule(bootstrapAngular)])
.directive('appRoot', downgradeComponent({ component: RootComponent, propagateDigest: false }))
;
angular.bootstrap(document, ['app', downgraded.name]);
Run Code Online (Sandbox Code Playgroud)
在我的index.html里面
<app id="app"></app>
Run Code Online (Sandbox Code Playgroud)
这很好用.
在我的主要angular.js组件中,我添加了降级后的主角度组件的标签:
<div class="app__view" id="appContent">
<ui-view></ui-view>
<app-root></app-root>
</div>
Run Code Online (Sandbox Code Playgroud)
这就是我的主模块的配置方式
const COMPONENTS = [
TestComponent,
RootComponent,
];
@NgModule({
declarations: COMPONENTS,
imports: [
BrowserModule,
NxModule.forRoot(),
RouterModule.forRoot(routes, {
initialNavigation: 'enabled',
useHash: true
})
],
providers: [
{ provide: APP_BASE_HREF, useValue: '/' …Run Code Online (Sandbox Code Playgroud) 我正在使用 oidc-client 构建 SPA,以登录到使用 Identity Server 4 构建的 IDP。
登录重定向似乎工作正常,但在 Firefox 上我遇到以下 CSP 问题
Content Security Policy: Ignoring "'unsafe-inline'" within script-src or style-src: nonce-source or hash-source specified (unknown)
Content Security Policy: The page's settings blocked the loading of a resource at self ("script-src 'unsafe-inline' 'sha256-VDXN0nOpFPQ102CIVz+eimHA5e+wTeoUUQj5ZYbtn8w='"). Source: !function(t){function __webpack_require_.... checksession:1
Content Security Policy: The page's settings blocked the loading of a resource at self ("script-src 'unsafe-inline' 'sha256-VDXN0nOpFPQ102CIVz+eimHA5e+wTeoUUQj5ZYbtn8w='"). Source: window.devToolsOptions = Object.assign(w.... checksession:1
Load denied by X-Frame-Options: http://localhost:5007/home/error?errorId=a74accc61bb821ee1f42f7013a306e90 does not permit cross-origin …Run Code Online (Sandbox Code Playgroud) javascript content-security-policy openid-connect identityserver4 oidc-client-js
我是C++的新手,当我遇到一个非常奇怪的问题时,我正试图从Project Euler中解决其中一个问题.我将错误减少到以下.
请考虑以下简单代码:
#include <iostream>
using namespace std;
int main() {
int numdigits;
cout << "digits: ";
cin >> numdigits;
char tmpchar;
cin >> tmpchar;
cout << atoi(&tmpchar) << endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
基本上,如果第一个输入(numdigits)低于48,一切正常,但如果输入为48或更高,如果有一个非常奇怪的行为:
air:programming santi$ ./lol
digits: 30
3
3 <--- OK
air:programming santi$ ./lol
digits: 48
3
30 <--- Not OK
air:programming santi$ ./lol
digits: 49
3
31 <--- Not OK
air:programming santi$ ./lol
digits: 50
3
32 <--- Not OK
Run Code Online (Sandbox Code Playgroud)
到底是怎么回事?我疯狂地试图找到算法中的错误,直到我发现错误出现在代码的那部分,我没有先去看.
提前致谢!