0

demo.Parent.html

<p>demo-parent works!</p>
<app-demo-child (property)="parentFunction($event)"  ></app-demo-child> 

demo.parent.component.ts

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-demo-parent',
  templateUrl: './demo-parent.component.html',
  styleUrls: ['./demo-parent.component.css']
})
export class DemoParentComponent implements OnInit {

  constructor() { }


  display : any;

  parentFuction(event: any){

    this.display=event;
    console.log(this.display);

  }
  ngOnInit() {
  }

}

demo.child.html

<p>demo-child works!</p>

demo.child.component.ts

export class DemoChildComponent implements OnInit {

@Output() property = new EventEmitter<String>();

 value : string="angualr";

  constructor() { 

  }


  senndData(){
    this.property.emit( this.value);
  }
  ngOnInit() {
  }

}

.

Expected 0 type arguments, but got 1

WARNING in ./node_modules/protractor/built/configParser.js Module not found: Error: Can't resolve 'coffee-script' in '/home/sangamnath/Desktop/angualr/ball/node_modules/protractor/built'

WARNING in ./node_modules/protractor/built/configParser.js Module not found: Error: Can't resolve 'coffeescript' in '/home/sangamnath/Desktop/angualr/ball/node_modules/protractor/built'

WARNING in ./node_modules/protractor/node_modules/source-map-support/source-map-support.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/protractor/node_modules/source-map-support'

WARNING in ./node_modules/protractor/node_modules/source-map-support/source-map-support.js Module not found: Error: Can't resolve 'module' in '/home/sangamnath/Desktop/angualr/ball/node_modules/protractor/node_modules/source-map-support'

ERROR in ./node_modules/saucelabs/index.js Module not found: Error: Can't resolve './lib-cov/SauceLabs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/saucelabs' ERROR in ./node_modules/protractor/built/runner.js Module not found: Error: Can't resolve 'child_process' in '/home/sangamnath/Desktop/angualr/ball/node_modules/protractor/built' ERROR in ./node_modules/protractor/built/debugger.js Module not found: Error: Can't resolve 'child_process' in '/home/sangamnath/Desktop/angualr/ball/node_modules/protractor/built' ERROR in ./node_modules/protractor/built/bpRunner.js Module not found: Error: Can't resolve 'child_process' in '/home/sangamnath/Desktop/angualr/ball/node_modules/protractor/built' ERROR in ./node_modules/selenium-webdriver/firefox/binary.js Module not found: Error: Can't resolve 'child_process' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver/firefox' ERROR in ./node_modules/selenium-webdriver/io/exec.js Module not found: Error: Can't resolve 'child_process' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver/io' ERROR in ./node_modules/selenium-webdriver/net/portprober.js Module not found: Error: Can't resolve 'child_process' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver/net' ERROR in ./node_modules/blocking-proxy/built/lib/webdriver_logger.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/blocking-proxy/built/lib' ERROR in ./node_modules/fs.realpath/index.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/fs.realpath' ERROR in ./node_modules/fs.realpath/old.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/fs.realpath' 1mERROR in ./node_modules/glob/glob.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/glob' ERROR in ./node_modules/glob/sync.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/glob' ERROR in ./node_modules/protractor/built/logger.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/protractor/built' ERROR in ./node_modules/protractor/built/driverProviders/direct.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/protractor/built/driverProviders' ERROR in ./node_modules/protractor/built/driverProviders/local.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/protractor/built/driverProviders' ERROR in ./node_modules/protractor/node_modules/webdriver-manager/built/lib/cli/logger.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/protractor/node_modules/webdriver-manager/built/lib/cli' ERROR in ./node_modules/rimraf/rimraf.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/rimraf' ERROR in ./node_modules/selenium-webdriver/chrome.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver' ERROR in ./node_modules/selenium-webdriver/edge.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver' ERROR in ./node_modules/selenium-webdriver/ie.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver' ERROR in ./node_modules/selenium-webdriver/opera.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver' ERROR in ./node_modules/selenium-webdriver/phantomjs.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver' ERROR in ./node_modules/selenium-webdriver/firefox/binary.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver/firefox' ERROR in ./node_modules/selenium-webdriver/firefox/profile.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver/firefox' ERROR in ./node_modules/selenium-webdriver/firefox/extension.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver/firefox' ERROR in ./node_modules/selenium-webdriver/io/index.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver/io' ERROR in ./node_modules/selenium-webdriver/lib/devmode.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver/lib' ERROR in ./node_modules/selenium-webdriver/net/portprober.js Module not found: Error: Can't resolve 'fs' in '/home/sangamnath/Desktop/angualr/ball/node_modules/selenium-webdriver/net'

4
  • Please share more details like HTML where you use property. Commented Feb 13, 2020 at 6:46
  • @sagar can you show how you called DemoChildComponent component in html Commented Feb 13, 2020 at 6:50
  • I have updated the code now look at it Commented Feb 13, 2020 at 6:55
  • @sagar-k update my answer Please check. Commented Feb 13, 2020 at 7:15

2 Answers 2

4

Try importing EventEmitter from Angular instead of from protractor:

import { Component, OnInit, Output, EventEmitter } from '@angular/core';

Sign up to request clarification or add additional context in comments.

2 Comments

Hi Vijay Import error has been cleared but now I not able to get data from a child
must be same type parent and child both component
1
//value : string="sam";

-> this.value is not defined, as it´s only a comment. Is that the case in your real code too?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.