Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 472k

Uncaught Syntax Error

Sep 23 2021 9:21 AM

Hi team

 

I need some help, i have an Angular js file called "Modal.js" sitting under Script folder on mvc asp.net project and have installed Angular JS using command on nu-get. Let me share the error, basically want to create modal popup using Angular js on my front end.

 

// Angular js

import { Component, Input } from '@angular/core';  // Error here Uncaught SyntaxError: Cannot use import statement outside a module"
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';


@Component({

    selector: 'ngb-modal-content',
    templateL ` <div class="modal-header">
        <h4 class= "modal-title" > Hi there!</h4>
    <button type="button" class="close" aria-label="Close" (click) = "activeModal.dismiss('Cross click')" >
    <span aria-hidden="true">&times;</span>
      </button >
    </div >
    <div class="modal-body">
      <p>Hello, {{name}}!</p>
    </div>
    <div class="modal-footer">
      <button type="button" class="btn btn-outline-dark" (click)="activeModal.close('Close click')">Close</button>
    </div >`
})

// index.chstml

<button class="btn btn-lg btn-outline-primary" (click)="open()"></button>


Answers (7)