I'm very new to Angular and web development in general, and I'm trying to follow this tutorial, and I got as far as adding the angular2 scripts to my index.html file, but when I try to run the application, I get the SyntaxError: expected expression, got '<' on all my .js scripts, line 1:0, which seems fairly common.
The strange thing is, when I open these scripts through the console, they all open index.html instead of the actual .js file, even the angular2 ones.
Here's index.html:
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head lang="en">
<title>Test Page</title>
</head>
<body ng-app="testApp" ng-controller="testController">
<p>Testing</p>
<app></app>
<script src="../../../node_modules/rxjs/bundles/Rx.umd.js"></script>
<script
src="../../../node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script
src="../../../node_modules/angular2/bundles/angular2-all.umd.dev.js"></script>
<script src="hello.js"></script>
<script src="refactor.js"></script>
</body>
</html>
hello.js, taken from this video:
import {bootstrap} from "../../../node_modules/angular2/platform/browser";
import {Component} from "../../../node_modules/angular2/core";
@Component({
selector:'app',
template:`<div>Hello World</div>`
})
class App{}
bootstrap(App);
And refactor.js, from the first tutorial mentioned:
var upgradeAdapter = new ng.upgrade.UpgradeAdapter();
angular.element(document.body).ready(function() {
upgradeAdapter.bootstrap(document.body, ['app']);
});
EDIT: I couldn't run ng-serve because the project wasn't created with ng new project. Could this be the problem?