Meteor-Angular2 icon indicating copy to clipboard operation
Meteor-Angular2 copied to clipboard

interface directive make template not load

Open vjau opened this issue 9 years ago • 1 comments

Hi, very strange bug while doing the tutorial. At step 2, we are creating a constructor which is population the "this.parties" class member. Since i know that typescript doesn't like to refer to an undefined variable, i created an interface like this:

interface IParty {
    name : string;
    description : string;
}

And i put

parties : IParty[]

in the class

But then the template didn't load anymore. No error message, no nothing, just a blank page. I started to remove stuff, and finally found the culprit : the interface directive !

If i write it like that :

class Socially{}
interface IParty {
    name : string;
    description : string;
}

All is well, the template loads.

But if i put the interface directive BEFORE the class, like this:

interface IParty {
    name : string;
    description : string;
}
class Socially{}

The template doesn't load anymore.

VERRRRY strange !

vjau avatar Aug 01 '15 07:08 vjau

Hi Vjau, that's pretty wild. I can't imagine what kind of wickedness would cause that.

Meteor is running the compiled JavaScript, which would not include the interfaces or types.

I've had a somewhat similar problem, but it was related to template caching in Chrome. The page wasn't properly updating and kept showing an older broken view; when I activated disable caching when console is open, the problem went away.

Also note sometimes Meteor's reload is a bit delayed. You may have been viewing an older broken view; but it's really hard to pin down the culprit.

If anyone else has experienced the same issue with interfaces breaking the code, give a +1.

ShMcK avatar Aug 02 '15 13:08 ShMcK