小编Ama*_*oze的帖子

如何在页面中使用组件

我正在尝试在多个页面中添加自定义组件。

  • 我创建了我的页面:ionic g pages name
  • 我创建了我的组件:ionic g component name

此时我只是尝试这个:

<ion-content>
    <app-menu-button></app-menu-button>
</ion-content>
Run Code Online (Sandbox Code Playgroud)

app-menu-button 是组件选择器

我收到此错误:1. If 'app-menu-button' is an Angular component, then verify that it is part of this module.

我尝试在我的应用程序模块文件中添加以下内容:

exports: [
    MenuButtonComponent
  ]
Run Code Online (Sandbox Code Playgroud)

但这不起作用。

我的目标是在多个页面中显示该组件。

谢谢,

ionic-framework angular ionic4 angular7

4
推荐指数
1
解决办法
6463
查看次数

Wait the end of a function before to start the next

I'm working on Ionic v4 with Angular.

In my project i use the BLE to communicate with a raspberry.

I have several step :

  1. Search Device around me
  2. Connect to this device
  3. Activate Notification
  4. Send Messages

Currently i have something like :

this.ble.scan().subscribe(result => {
  if (device === theDeviceIWant) {
    this.ble.connect(device.id).subscribe(result => {
      this.ble.startNotification(infosaboutDevice).subscribe(result => {
        // Message 1
        this.ble.writeWithoutResponse(infos, message).then(result => {
          // Message 2
          this.ble.writeWithoutResponse(infos, message).then(result => { 
            // Message 3
            this.ble.writeWithoutResponse(infos, message).then(result => {
              // Message X …
Run Code Online (Sandbox Code Playgroud)

javascript async-await ionic-framework es6-promise angular

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