小编Geo*_* C.的帖子

Typescript ReferenceError:未定义导出

尝试按照官方手册实现模块,我收到以下错误消息:

未捕获的ReferenceError:未定义导出

在app.js:2

但我的代码中没有任何地方使用该名称exports.

我怎样才能解决这个问题?


档

app.ts

let a = 2;
let b:number = 3;

import Person = require ('./mods/module-1');
Run Code Online (Sandbox Code Playgroud)

模块1.T

 export class Person {
  constructor(){
    console.log('Person Class');
  }
}
export default Person;
Run Code Online (Sandbox Code Playgroud)

tsconfig.json

{
   "compilerOptions": {
        "module": "commonjs",
        "target": "es5",
        "noImplicitAny": false,
        "sourceMap": true,
        "outDir": "scripts/"
    },
    "exclude": [
        "node_modules"
    ]
}
Run Code Online (Sandbox Code Playgroud)

module typescript

76
推荐指数
11
解决办法
13万
查看次数

Angular 4前端与python flask后端如何呈现简单的索引页面

Hello Python社区我是角度和node.js开发人员,我想尝试Python作为我的服务器的后端,因为我是python的新手我想问你如何定位包含所有HTML和CSS和js文件的dist文件夹flask python服务器中的angular 4应用程序

因为我的应用程序是SPA应用程序,我在angular routing组件中设置了路由

当我运行或任何其他路线时,我得到这个字符串消息'./dist/index.html' 我知道我返回字符串消息但我想告诉烧瓶用户在URL上输入的任何路由让角度呈现页面,因为在我的角度应用程序中我设置了这个页面和工作

任何帮助如何从flask和angular开始构建简单的REST API

现在我有了这个文件结构

python-angular4-app
                  |___ dist
                  |      |___ index.html
                  |      |___ style.css
                  |      |___ inline.js
                  |      |___ polyfill.js
                  |      |___ vendor.js
                  |      |___ favicon.ico
                  |      |___ assets
                  |
                  |___ server.py
Run Code Online (Sandbox Code Playgroud)

我的server.py有这个内容

from flask import Flask

app = Flask(__name__, )

@app.route('/')
def main():
    return './dist/index.html'


@app.route('/about')
def about():
    return './dist/index.html'


@app.route('/contact')
def contact():
    return './dist/index.html'

if __name__ == "__main__":
    app.run(debug=True)
Run Code Online (Sandbox Code Playgroud)

最好的问候George35mk thnx的帮助

python rest flask angular

15
推荐指数
1
解决办法
8278
查看次数

OpenCV-如何使用棋盘作为参考从2D图像获取真实世界的距离

在此处输入图片说明

在检查了几段代码后,我拍摄了几张照片,找到了棋盘角,并用它们来获取相机矩阵,失真系数,旋转和平移矢量。现在,有人可以告诉我我需要哪个python opencv函数来计算2D图像在现实世界中的距离吗?项目要点?例如,以棋board为参考(参见图片),如果瓷砖大小为5cm,则4个瓷砖的距离应为20cm。我看到了一些函数,例如projectPoints,findHomography,solvePnP,但不确定要解决我的问题并获取相机世界和棋盘世界之间的转换矩阵,我不确定。1个单摄像头,在所有情况下,摄像头的位置相同,但不完全在棋盘上方,并且将棋盘放置在平面物体(桌子)上方

# prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0)
    objp = np.zeros((nx * ny, 3), np.float32)
    objp[:, :2] = np.mgrid[0:nx, 0:ny].T.reshape(-1, 2)

    # Arrays to store object points and image points from all the images.
    objpoints = []  # 3d points in real world space
    imgpoints = []  # 2d points in image plane.

    # Make a list of calibration images
    images = glob.glob(path.join(calib_images_dir, 'calibration*.jpg'))
    print(images)
    # Step through the list and search for chessboard corners
    for filename …
Run Code Online (Sandbox Code Playgroud)

python opencv camera-calibration

11
推荐指数
1
解决办法
1132
查看次数

如何使用(迷你变体)实现sidenav导航抽屉

角度材料2社区我需要你的帮助如何在角度材料2中制作像谷歌材料设计示例的迷你变体.

我尝试实现这一点,但我无法实现这一点

在此输入图像描述

我的代码到目前为止

  <!-- ===================================================================== -->
  <!-- SIDENAV && SIDENAV CONTAINER -->
  <!-- ===================================================================== -->
  <mat-sidenav-container>

    <mat-sidenav 
      #adminNavMenu 
      mode="side" 
      opened="true"
      style="min-width:50px; background: #F3F3F3;"
      class="shadow_right" autosize>

      <!-- MENU LEFT -->
      <app-admin-menu-left></app-admin-menu-left>

    </mat-sidenav>

   <mat-sidenav-container>
Run Code Online (Sandbox Code Playgroud)

应用程序管理员菜单,left.html

<mat-nav-list style="min-width:60px;">

  <mat-list-item *ngFor="let page of Menus"> 
    <a routerLink="{{page.link}}" routerLinkActive="active" 
      [routerLinkActiveOptions]="{exact:true}" matLine>
      <mat-icon class="home_icon collapse-icon vcenter" mat-list-icon>{{page.icon}}</mat-icon>
      <span *ngIf="!showFiller">
        {{page.name}}
      </span>
    </a>
  </mat-list-item>


</mat-nav-list>

<button  mat-icon-button (click)="showFiller = !showFiller" mat-raised-button>
  <mat-icon *ngIf="!showFiller">chevron_right</mat-icon>
  <mat-icon *ngIf="showFiller">chevron_left</mat-icon> 
</button>
Run Code Online (Sandbox Code Playgroud)

结束给了我这个意外的结果

在此输入图像描述

点击后查看迷你吧 在此输入图像描述

如您所见,有250 px的余量,mat-sidenav-content但我无法访问此元素.

在此输入图像描述

任何帮助解决这个问题都会很有用.

感谢名单

angular-material2 angular

10
推荐指数
2
解决办法
2万
查看次数

从联系表单发送电子邮件与firebase功能和nodemailer

我使用的技术是

  • Angular 4
  • 火力地堡
  • firebase托管
  • firebase功能
  • firebase实时数据库
  • firebase存储

我在firebase托管上托管我的网站,我有一个像图片的联系表格,我希望每次用户提交该表格,发送电子邮件给网站管理员怎么样,我可以用firebase和Nodemailer发送电子邮件怎么样可能的,我是firebase功能的新手,我不知道该怎么做.

我可以在函数文件夹中索取index.js中的nodemailer或者这是错误的吗?

我在图片中有这样的联系表格

在此输入图像描述

firebase nodemailer google-cloud-functions angular

6
推荐指数
1
解决办法
7620
查看次数

Opencv C++ MinGW VSCode致命错误编译

大家好我想使用VSCode MinGW C++和OpenCV创建一个简单的opencv项目,但由于未知原因,我得到这个错误我该怎么办?

我想提一下,Visual studio 2017我可以在x64架构上运行main.cpp.

我想在VSCode上运行的代码与我在Visual Studio 2017上运行的代码相同.

经过10天的尝试,50 points如果有人证明以下情况,我会放弃:

  • VSCODE
  • C++ 17
  • OpenCV的
  • 在Windows 10 x64架构上

一个成功的构建.

SRC/main.cpp中

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>

using namespace cv;
using namespace std;

int main() {

    Mat image;
    image = imread("./22.png", IMREAD_COLOR); // Read the file

    namedWindow("Display window", WINDOW_AUTOSIZE); // Create a window for display.

    if (!image.data) // Check for invalid input
    {
        cout << "Could not open or find the image" << std::endl;
    } else { …
Run Code Online (Sandbox Code Playgroud)

c++ opencv mingw visual-studio-code

6
推荐指数
1
解决办法
2877
查看次数

如何对角度@Output进行单元测试

覆盖率报告中的问题: 在此处输入图片说明

我在components.ts中有这段代码

export class TimelinePlotComponent implements OnInit, OnChanges, OnDestroy {

form: FormGroup;
@Output() onchange: EventEmitter<any> = new EventEmitter<any>();

constructor() {}

initForm() {
    this.form = new FormGroup({
      timeRange: new FormControl(this.time_range_options_active, []),
      metric: new FormControl(this.metric_options_active, []),
      groupBy: new FormControl(this.group_by_options_active, []),
    });

    // How to unit test this part of the code
    this.form.valueChanges.subscribe( res => {
      console.log('form-changed');
      this.onchange.emit(res);
    });
  }

}
Run Code Online (Sandbox Code Playgroud)

组件规格

  fit('should listen for form changes', async() => {
    component.form.controls['groupBy'].setValue('color');
    fixture.detectChanges();
    fixture.whenStable().then(() => {
      // your expectations.
      expect(component.form.valid).toBeTruthy();
      component.onchange.subscribe( res => { …
Run Code Online (Sandbox Code Playgroud)

karma-jasmine angular

5
推荐指数
1
解决办法
1608
查看次数

从 Identity Server 4 注销不会从客户端注销

我有一个与https://github.com/IdentityServer/IdentityServer4/issues/3153类似的问题

我正在使用 Asp Net Identity 和 EF Core 组合示例,一切正常,数据库、播种、api 调用,除了我尝试从 IS 页面注销时。它不会删除.AspNetCore.Cookies保持用户登录客户端的那个。

    [HttpPost]
    [ValidateAntiForgeryToken]
    public async Task<IActionResult> Logout(LogoutInputModel model)
    {

        // build a model so the logged out page knows what to display
        var vm = await BuildLoggedOutViewModelAsync(model.LogoutId);

        if (User?.Identity.IsAuthenticated == true)
        {
            _log.LogCustomInfo(LoggingType.Information, "<AUDIT>" + "Logout: User Is Authenticated" + "</AUDIT>");

            try
            {
                await _signInManager.SignOutAsync();
                await HttpContext.SignOutAsync(IdentityConstants.ApplicationScheme);
                await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme);
                // raise the logout event
                await _events.RaiseAsync(new UserLogoutSuccessEvent(User.GetSubjectId(), User.GetDisplayName()));
            }
            catch (NotSupportedException)
            {
                _log.LogCustomInfo(LoggingType.Information, "<AUDIT>" + …
Run Code Online (Sandbox Code Playgroud)

security .net-core identityserver4 angular

5
推荐指数
1
解决办法
5181
查看次数

如何在Angular 5中的Firestore集合中包含文档ID

我有这个功能,获取所有帖子,我想得到帖子的ID任何想法如何获取帖子的ID或如何在我将文档添加到集合时包含id

get_the_posts(){
    this.Post_collection = this.afs.collection('posts'); 
    return this.Posts = this.Post_collection.valueChanges();
}
Run Code Online (Sandbox Code Playgroud)

这给了我这个输出:

[
   { name: 'post 1 name' description: 'post description'}, 
   { name: 'post 2 name' description: 'post description'},
   { name: 'post 3 name' description: 'post description'},
]
Run Code Online (Sandbox Code Playgroud)

我想要这个输出

[
   { id: 'm9mggfJtClLCvqeQ', name: 'post 1 name' description: 'post description'}, 
   { id: 'm9mggfJtCldsadaf', name: 'post 2 name' description: 'post description'},
   { id: 'm9mggfJtCdsasavq', name: 'post 3 name' description: 'post description'},
]
Run Code Online (Sandbox Code Playgroud)

angularfire2 google-cloud-firestore

4
推荐指数
2
解决办法
2762
查看次数

使用angularFire 2的Firebase firestore集合计数

我想获取firestore中存在的文档总数.我不想只获取数据内部产品集合的总数我有200,000个项目是可能的Angular 4-5,而不是angular.js

有人可以告诉我如何实现这一目标吗?

我的代码到目前为止并没有用

  get_total_messages() {
    this.messages_collection = this.afs.collection<MessageEntity>('messages');
    return this.messages_collection.snapshotChanges();
  }
Run Code Online (Sandbox Code Playgroud)

结束这是我尝试获取数据但不是我想要的方式;

this.firebase_Service.get_total_messages().subscribe( data => {
   console.log(data);
});
Run Code Online (Sandbox Code Playgroud)

firebase angularfire2 google-cloud-firestore

3
推荐指数
1
解决办法
3301
查看次数