Share via

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

Gcobani Mkontwana 21 Reputation points
2021-09-23T09:05:10.79+00:00

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>

Developer technologies | ASP.NET Core | Other
0 comments No comments

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 84,071 Reputation points
    2021-09-23T15:09:42.543+00:00

    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.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.