question

GcobaniMkontwana-0775 avatar image
0 Votes"
GcobaniMkontwana-0775 asked Bruce-SqlWork answered

How to read Angular js files from View using asp.net mvc?

HI Team

I am using Angular Js to create a modal popup and installed via nu-get command latest version. On VS there are libraries. Some strange reason my Angular.js file doesnt load when i want to call View(razor file for modal popup. What am missing?


// Angular Js

import { Component, Input } from '@angular/core';
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.cshtml
<button class="btn btn-lg btn-outline-primary" (click)="open()"></button>

dotnet-aspnet-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Bruce-SqlWork avatar image
0 Votes"
Bruce-SqlWork answered

First you transpile the angular code to .js script, then include the script on the required pages. How this is done will depend on what node tools you picked to support angular builds.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.