0

I am using the login() function in my Chrome extension. I am trying to call the function when form submit. But, the function is not called in a Chrome extension. But, when I run the project in an Angular way the function is called.

This is my HTML code.

  <form  (ngSubmit)="login()" id="SignIn">

and my ts code is

login(){
    alert("form submitted");
  }

I referred to the following blog link angular 2 chrome extension

and my manifest file is

{
  "manifest_version": 2,

  "name": "chrome extension",
  "description": "This extension will used to simplify the project",
  "version": "1.0",

  "browser_action": {
    "default_icon": "icon.png",
    "default_popup": "popup.html"
  },
  "permissions": [
    "http://example.com/*",
    "activeTab"
  ]
}

I want to handle the events with in a component.i don't want to the another script file.

Sakthivel
  • 139
  • 1
  • 16
  • actually your form is with button for submit ? try –  Sep 15 '17 at 05:34
  • i am trying to .But it also not working – Sakthivel Sep 15 '17 at 05:36
  • in your console there is no error ? –  Sep 15 '17 at 05:37
  • i don't have any console error. – Sakthivel Sep 15 '17 at 05:42
  • try to re install and verify that you imported FormModule in your appmodule –  Sep 15 '17 at 05:45
  • 1
    You're looking at the wrong console. Right click the popup, then Inspect. You'll see an error about inline code not allowed in html. I don't know angular, but in normal js you can use addEventListener. – wOxxOm Sep 15 '17 at 08:00
  • What *exactly* is shown in the [various appropriate consoles for your extension](https://stackoverflow.com/a/38920982/3773011) when you load and execute your extension? – Makyen Sep 15 '17 at 18:40
  • You will probably also encounter: [Chrome extension form input text is blank on submit](https://stackoverflow.com/q/40176525) – Makyen Sep 15 '17 at 18:56

0 Answers0