Reputation: 617
My problem is that I want to use my Appointment class in my app.ts file.
I reference it in my app.ts on the top:
/// <reference path="Appointment.ts"/>
Then I instantiate it and print the clientID:
var app : Appointment = new Appointment(1, 2, "User", 3);;
console.log(app.ClientID);
But then I get ReferenceError: Appointment is not defined
I also added the .js script of Appointment to my html file.
My Appointment looks like this:
class Appointment {
// some properties
constructor(clientID: number, state: number, userCreated: string, activityID: number) {
// constructor
}
}
Upvotes: 0
Views: 914
Reputation: 250812
Your script references should look like this (order is important... and .js
file extension is important too!)
<script src="Appointment.js"></script>
<script src="app.js"></script>
Upvotes: 1