我在尖角前端应用程序中使用星云,并希望设置选定的活动链接。我该如何实现?
我尝试过使用menuItem的selected属性,但是它仅应用于item对象,没有[routerLinkActive]选项
@Component({
selector: 'nebular-pages',
styleUrls: ['nebular.component.scss'],
template: `
<ngx-sample-layout>
<nb-menu [items]="menu"></nb-menu>
<router-outlet></router-outlet>
</ngx-sample-layout>
`,
})
export class NebularComponent {
menu: NbMenuItem[];
constructor() { }
this.menu = [
{
title: 'Page1',
link: `/user/params`,
icon: 'nb-grid-b-outline',
home: true,
},
{
title: 'Page2',
link: '/user/options',
icon: 'nb-arrow-thin-right',
},
{
title: 'Page3',
icon: 'nb-list',
children:[
{
title: 'Costs',
link: '/user/costs',
icon: 'nb-arrow-thin-right',
},
{
title: "Benifits",
link: "/user/benifits",
icon: "nb-compose"
},
]
},
];
Run Code Online (Sandbox Code Playgroud) 我正在使用 ASPNetCore 和 Angular 7。我的 Angular 应用程序变得越来越大,所以每次运行时重新编译 C# 代码和 Angular 代码变得很麻烦。
我的 Startup.cs 文件中有这一行。
if (env.IsDevelopment()) {
spa.UseAngularCliServer(npmScript: "start");
}
Run Code Online (Sandbox Code Playgroud)
A. 是否有可能在我终止 ASPNet 应用程序时保持它运行,或者 B 单独运行它并仍然通过 aspnet 应用程序使用的相同 SSL 端口路由请求?
由于 angular 具有热模块替换功能,我只想保持 99% 的时间运行,并在更改 C# 代码时重新编译我的后端。
我是角度新手,现在正在使用一些遗留代码。在一个组件中有一个带有 let 循环的表。在网上查了一下,但不太理解。
<ng-template #itemTmpl let-data let-element="element">
<ng-container *ngIf="data === 'route'"> {{ currentRouteSubject.value.number }} </ng-container>
<ng-container *ngIf="data === 'name'">
<ng-container *ngIf="!editRouteScheduleMap.has(element.id)"> {{ element[data] }} </ng-container>
<ng-container *ngIf="editRouteScheduleMap.has(element.id)">
<input type="text" [(ngModel)]="editRouteScheduleMap.get(element.id).name" />
</ng-container>
</ng-container>
<ng-container *ngIf="data === 'requiredBusAmount'">
<ng-container *ngIf="!editRouteScheduleMap.has(element.id)"> {{ element[data] }} </ng-container>
<ng-container *ngIf="editRouteScheduleMap.has(element.id)">
<input type="text" [(ngModel)]="editRouteScheduleMap.get(element.id).requiredBusAmount" />
</ng-container>
</ng-template>
Run Code Online (Sandbox Code Playgroud)
你能解释一下这个 let-data, let-element='element' 以及它如何与源文件连接
javascript node.js single-page-application typescript angular
一段时间以来,我一直在尝试将 Web3 安装到我的 Ionic v4 项目中。当我为项目提供服务时,它不断抛出错误。我收到一条错误,指出引用错误:全局未定义。
import { Component } from '@angular/core';
import { Web3 } from 'web3';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
web3 = new Web3(new Web3.providers.HttpProvider('https://rinkeby.infura.io/v3/apikey...'));
constructor() {}
test(){
console.log(this.web3);
}
}
Run Code Online (Sandbox Code Playgroud)
core.js:9110 ERROR Error: Uncaught (in promise): ReferenceError: global is not defined
ReferenceError: global is not defined
at Object../node_modules/stream-http/lib/capability.js (capability.js:1) …
Run Code Online (Sandbox Code Playgroud) 我已经创建了 React 应用程序,我需要为其他网站生成嵌入代码。这是一个大型应用程序,我只想将一个组件作为其他域的小部件。我已阅读使用 React 和 Webpack 编写可嵌入的 Javascript 插件以及如何将React组件嵌入其他域?. 我设置了我的 webpack,但仍然无法在另一个域上呈现小部件。
这个小部件应该:
<script>
标签获得,而不是 iframe/referral
),而不是所有应用程序小部件是一个按钮和弹出窗口,通过单击按钮显示。
这是我webpack.config.js
的client
文件夹:
const path = require('path');
const bundleOutputDir = './referral';
const env = require('yargs').argv.env;
module.exports = env => {
const isDevBuild = !(env && env.prod);
if (env === 'build') {
mode = 'production';
} else {
mode = 'development';
}
return [
{
mode: mode,
entry: './src/components/early-referrals/Referral.js',
output: {
filename: 'widget.js', …
Run Code Online (Sandbox Code Playgroud) webpack.config.js
const path = require('path')
HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: './src/index.js',
output: {
path: path.join(__dirname, 'dist'),
filename: 'index_bundle.js',
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ["@babel/preset-env", "@babel/preset-react"],
plugins: ["@babel/plugin-proposal-class-properties"]
}
}
},
{
test:/\.css$/,
use:['style-loader','css-loader']
}
]
},
plugins: [
new webpack.DefinePlugin({
APIHOST: JSON.stringify('test'),
BLOCKCHAINHOST: JSON.stringify('test')
}),
new HtmlWebpackPlugin({
template: './src/template.html'
}),
]
}
Run Code Online (Sandbox Code Playgroud)
我定义了 2 个变量 APIHOST 和 BLOCKCHAINHOST,我尝试在 ReactJS App.js 中控制台记录它,如下所示
componentDidMount() {
console.log(APIHOST)
}
Run Code Online (Sandbox Code Playgroud)
我收到的错误是 …
我在这里有点挣扎:我在 ngrx 效果中,我想对我的服务进行身份验证,并根据我的服务的回答,分派到操作以检索信息,然后才分派“YEAH LOGIN IS”类型的操作好的”
this is my code so far
this.actions$.pipe(
ofType(AuthActions.QuickLogin),
switchMap((action: any) =>
this.authService.postQuickLogin$(action.QuickVerifString).pipe(
switchMap(resultService => {
const props = {
username: resultService['username'],
token: resultService['token'],
isAuthenticated: true
}
this.localStorageService.setItem(AUTH_KEY, props)
return [
MoMenuActions.moMenuHttpGetListAction({ US_ID: props.username }),
UserActions.userHttpGetInfoAction({ US_ID: props.username }),
AuthActions.LoginSucceed(props)
]
}),
catchError(error => of(AuthActions.LoginError({ error })))
)
)
)
Run Code Online (Sandbox Code Playgroud)
这运行良好。直到我遇到在 momenuaction 和 useraction 中出现 http 错误的问题,并且我没有输入我的 catch 错误。这是正常的,因为 switchMap 取消了前一个 observable 而只取最后一个。我可以先映射然后映射然后映射 LoginSucceed 但在这种情况下我没有道具来调度我的 LoginSucceed
所以我不仅在寻找一种方法来做到这一点,而且在寻找“好的”/正确的方法来做到这一点。
如果有人有任何解决方案和原因的解释?
无论我做什么,在构建项目后我都会收到以下错误:
Error parsing bundle asset "<path-to-project>\polyfills-es5-es2015.e1bdcd70857e70f37509.js": no such file
events.js:174
Run Code Online (Sandbox Code Playgroud)
看到我的项目创建了一个polyfills-es5.e1bdcd70857e70f37509
文件和一个polyfills-es2015.25bfed26497f24d6d1d7
文件,这是完全正确的。
这是在我昨天创建的nx工作区项目中
每次构建后,文件名显然都会更改,但它一直在寻找混合的es5-es2015
polyfills文件。
stats文件创建为stats-es2015.json
,我们的package.json设置为:"bundle-report": "webpack-bundle-analyzer dist/apps/<project-name>/stats-es2015.json"
我不断收到与错误default
编译或production
与ivy
启用或禁用,我前夕试图删除es5BrowserSupport
标志,希望只会有一个polyfills文件,但它仍然在寻找es5-es2015
文件...
我在使用提取加载器时遇到问题。我尝试添加背景: url(../../assets/icons/upload.svg); sass,但我得到一个错误。
Error: Cannot find module '../../assets/icons/upload.svg' from '/home/jeremy/code/sample-project/src/styles'
Run Code Online (Sandbox Code Playgroud)
尝试了 resolve-url-loader,但没有成功。我的 webpack 配置:
module: {
rules: [
{
test: /\.(js)$/,
exclude: /node_modules/,
loader: require.resolve('babel-loader'),
},
{
test: /\.(png|svg|jpg|gif)$/,
include: [
path.resolve(__dirname, 'src/assets/'),
],
use: [
'file-loader'
],
},
{
test: /\.hbs$/,
loader: require.resolve('handlebars-loader'),
query: {
inlineRequires: '/assets/',
},
},
{
test: /\.scss$/,
use: [
{
loader: require.resolve('file-loader'),
options: {
name: 'main.css',
}
},
require.resolve('extract-loader'),
require.resolve('css-loader'),
require.resolve('postcss-loader'),
require.resolve('sass-loader'),
],
}
]
},
Run Code Online (Sandbox Code Playgroud) 我尝试svg-inline-loader
在多页项目中使用。
当我在索引页面上使用它时它工作正常
<%= require('!svg-inline- loader!../../img/toolbar/'+firstBtn.iconName+'.svg') %>
Run Code Online (Sandbox Code Playgroud)
但是当我尝试将它注入部分文件时,它不起作用。我得到
Html Webpack Plugin:
ReferenceError: require is not defined
- lodash.templateSources[16]:7 eval
lodash.templateSources[16]:7:50
- loader.js:31 eval
[search.html?..]/[html-webpack-plugin]/lib/loader.js:31:106
- loader.js:36 module.exports
[search.html?..]/[html-webpack-plugin]/lib/loader.js:36:3
- index.js:422
[site.local]/[html-webpack-plugin]/index.js:422:16
Run Code Online (Sandbox Code Playgroud)
我的 webpack 配置
{
test: /\.html$/,
include: [path.resolve('src/html/partials/')],
use: ['html-loader']
},
new HtmlWebpackPlugin({
filename: 'index.html',
template: './html/pages/index.html',
chunks: ['main']
}),
new HtmlWebpackPlugin({
filename: 'login.html',
template: './html/pages/login.html',
chunks: ['login', 'main']
}),
new HtmlWebpackPlugin({
filename: 'search.html',
template: './html/pages/search.html',
chunks: ['main']
}),
Run Code Online (Sandbox Code Playgroud)
我的搜索页面
<% var toolbar = {
firstBtn: {
title: …
Run Code Online (Sandbox Code Playgroud) javascript ×7
node.js ×7
angular ×6
webpack ×5
typescript ×4
ecmascript-6 ×3
reactjs ×2
asp.net-core ×1
c# ×1
ecmascript-5 ×1
nebular ×1
ngrx ×1
npm ×1
redux ×1
rxjs ×1
sass ×1
svg ×1