Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 4 : Unterminated regular expression literal

I'm learning angular and i've created a registration component but I have the following error :

registration.component.ts (4,19): Unterminated regular expression literal.

/app/registration/registration.component.ts

import { Component } from ‘@angular/core’;
@Component({
     selector : ‘app-registration’,
     templateUrl : ‘./registration.component.html’,
     styleUrls : [‘./registration.component.css’]
})
export class RegistrationComponent{}

/app/app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { RegistrationComponent } from 
'./registration/registration.component';

 @NgModule({
 declarations: [
   AppComponent,
   RegistrationComponent
],
 imports: [
   BrowserModule,
   FormsModule
],
   providers: [],
   bootstrap: [AppComponent]
})
export class AppModule { }

I need to understand where is my error and why the compile failed thank you

like image 712
xUnoamon Avatar asked Jan 01 '26 10:01

xUnoamon


1 Answers

Its operator error :

replace this with '.


From this :

import { Component } from ‘@angular/core’;
...
selector : ‘app-registration’,
templateUrl : ‘./registration.component.html’,
styleUrls : [‘./registration.component.css’]

To

import { Component } from '@angular/core';
...
selector : 'app-registration',
templateUrl : './registration.component.html',
styleUrls : ['./registration.component.css']
like image 152
Vivek Doshi Avatar answered Jan 03 '26 10:01

Vivek Doshi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!