0
votes

module not found '@angular/core','@angular/platform-browser',same with 3rd one!!

   import {
  NgModule,
  Component
 } from '@angular/core';
 import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-   dynamic';

@Component({ selector: 'hello-world', template: <div> Hello world </div> })

class HelloWorld { }

 @NgModule({
 declarations: [ HelloWorld ],
 imports: [ BrowserModule ],
 bootstrap: [ HelloWorld ],
 })

 class HelloWorldAppModule {}

 platformBrowserDynamic().bootstrapModule(HelloWorldAppModule);
2

2 Answers

0
votes

Backticks define Template Strings \ Template literals in TypeScript and ES6.

These do allow strings to be multi-line (which is the main reason why Angular2 uses them, I suppose) and to use string interpolation features.

Sample for string interpolation:

var name = "World";
console.log(`Hello ${name}!`); // Outputs 'Hello World!'
0
votes

In ES6, there is Template String feature, that says, we can form/concat string with backtick.

var name = 'Mustkeem';
var info = `My name is ${name}.`; // My name is Mustkeem.

Other important point to consider is, these backtick support for multi line templates.

However you should use Angular's interpolation syntax {{}} instead of ${}. Because angular's interpolation syntax have some merits like you can also use expressions ({{a + b / 2}}) and pipes ({{title | uppercase}}).