Angular2 and MVC Integration: JavaScript Fails to Run

Angular component’s template points to an MVC view, yet its embedded JavaScript doesn’t execute properly. See the revised Angular component and MVC view examples below:

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-demo',
  templateUrl: '/Render/Display'
})
export class DemoComponent implements OnInit {
  ngOnInit() { /* Initialization logic */ }
}
@{ Layout = null; }
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <title>Display Page</title>
  <script type="text/javascript">
    function modifyContent() {
      document.getElementById('result').innerText = 'Content updated using JS';
    }
  </script>
</head>
<body onload="modifyContent();">
  <div>
    <h2>MVC Rendered View</h2>
    <p id="result">Original Text</p>
  </div>
</body>
</html>

hey, try movin your js script to the bottom of the html. angular might be loadin things in a diff order, causin onload event issues. check the console for any error msgs, it might give you a clue.