ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

ionic build android fail when used @ViewChild("cmpName")

Open decpio opened this issue 9 years ago • 1 comments

Ionic version: (check one with "x") [ ] 1.x [x ] 2.x

I'm submitting a ... (check one with "x") [x ] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior: "ionic build android" and "ionic run android" fail when used @ViewChild("cmpName")

Expected behavior: Syntax is ok, compilation process should work properly

Steps to reproduce: download ionic blank template with ionic2@RC3 and install android platform. Add <ion-input #inp type="text"> to any *.html page and @ViewChild("inp") inp: TextInput; // <<-- Error: Property '_inp' does not exist on type 'HomePage'. to *ts file then try to compile android platform.

example: http://plnkr.co/edit/GJte2b?p=preview

Related code:

insert any relevant code here
import { Component, ViewChild } from '@angular/core';
import { NavController, TextInput } from 'ionic-angular';
@Component({
  selector: 'page-home',
  template: '
<ion-header></ion-header>
<ion-content padding>
  <ion-input #inp type="text"></ion-input>
</ion-content>
'})
export class HomePage {
  @ViewChild("inp") inp: TextInput; // <<-- Error: Property '_inp' does not exist on type 'HomePage'.
   appName = 'Ionic App';
  constructor(private navController: NavController) { }
}


**Other information:**
ionic serve work fine.
when you use @ViewChild(TypeName) instead then it works. 
Only android build fail, other platforms not testet.

**Ionic info:** (run `ionic info` from a terminal/cmd prompt and paste output below):

ionic-app-scripts build

[08:36:04] ionic-app-scripts 0.0.45
[08:36:04] build prod started ...
[08:36:04] clean started ...
[08:36:04] clean finished in 5 ms
[08:36:04] copy started ...
[08:36:04] ngc started ...
[08:36:04] copy finished in 416 ms
[08:36:39] Error: Error at B:/Projects/InvTabletApp/InvTabletApp/.tmp/pages/inventory/inventory.ngfactory.ts:585:18
[08:36:39] Property '___lokInput' does not exist on type 'InventoryPage'.
[08:36:39] Error at B:/Projects/InvTabletApp/InvTabletApp/.tmp/pages/inventory/inventory.ngfactory.ts:587:18
[08:36:39] Property '___itemInput' does not exist on type 'InventoryPage'.
[08:36:39] Error at B:/Projects/InvTabletApp/InvTabletApp/.tmp/pages/inventory/inventory.ngfactory.ts:589:18
[08:36:39] Property '___qtyInput' does not exist on type 'InventoryPage'.
[08:36:39] Error at B:/Projects/InvTabletApp/InvTabletApp/.tmp/pages/check-item/check-item.ngfactory.ts:424:18
[08:36:39] Property '___itemInput' does not exist on type 'CheckItemPage'.
[08:36:39] ngc failed
[08:36:39] ionic-app-script task: "build"
[08:36:39] Error: Error

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "run" "build"
npm ERR! node v6.7.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: ionic-app-scripts build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script 'ionic-app-scripts build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the inv-tablet-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs inv-tablet-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls inv-tablet-app
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! B:\Projects\InvTabletApp\InvTabletApp\npm-debug.log



decpio avatar Dec 05 '16 08:12 decpio

This issue was moved to driftyco/ionic-app-scripts#512

jgw96 avatar Dec 05 '16 15:12 jgw96