我试图将我的Angular应用程序导出为npm模块以供其他应用程序使用,但遇到了一些困难.我无法在互联网上的任何其他地方找到此错误,而且我的智慧结束了.
我按照本教程:https://medium.com/@nikolasleblanc/building-an-angular-4-component-library-with-the-angular-cli-and-ng-packagr-53b2ade0701e
我使用ng-packagr将我的应用程序导出为npm模块.我可以从准系统测试应用程序上的本地文件夹成功安装它,但无法让它显示我的应用程序.
错误:
AppComponent.html:1 ERROR Error: inject() must be called from an injection context
at inject (core.js:1362)
at ChangeStackService_Factory (template-wiz.js:2074)
at _callFactory (core.js:8223)
at _createProviderInstance (core.js:8181)
at resolveNgModuleDep (core.js:8156)
at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:8849)
at resolveDep (core.js:9214)
at createClass (core.js:9094)
at createDirectiveInstance (core.js:8971)
at createViewNodes (core.js:10191)
Run Code Online (Sandbox Code Playgroud)
template-wiz.module.ts(正在导出的模块)
import { NgModule, ChangeDetectorRef, ComponentFactoryResolver } from '@angular/core';
import { TemplateWizComponent } from './template-wiz.component';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpClientModule } from …Run Code Online (Sandbox Code Playgroud)我正在尝试使用 react-bootstrap 创建表单,但无法弄清楚如何使用水平表单布局。下面是我的 signin.js 代码。
import React, {Component} from 'react';
import {reduxForm} from 'redux-form';
import {Form, FormGroup, FormControl, ControlLabel, Col, Button} from 'react-bootstrap';
class Signin extends Component{
handleFormSubmit({username,password}){
console.log(username,password);
}
render(){
const {handleSubmit, fields: {username,password}}=this.props;
return(
<Form horizontal className="col-sm-6 offset-sm-3" onSubmit={handleSubmit(this.handleFormSubmit.bind(this))}>
<FormGroup>
<Col componentClass={ControlLabel} sm={2}>
Username:
</Col>
<Col sm={10}>
<FormControl {...username} type="text" />
</Col>
</FormGroup>
<FormGroup>
<Col componentClass={ControlLabel} sm={2}>
Password:
</Col>
<Col sm={10}>
<FormControl {...password} type="password" />
</Col>
</FormGroup>
<FormGroup>
<Col>
<Button type="submit">Submit</Button>
</Col>
</FormGroup>
</Form>
);
}
}
export …Run Code Online (Sandbox Code Playgroud)