R
R
Roman Rakzin2019-03-29 18:21:02
JavaScript
Roman Rakzin, 2019-03-29 18:21:02

How to include a Typescript file in an Angularjs Nativescript project?

I want to add a file but I get an error

Файл 1

class GlobalDataClass {
        public  static articles=[1,2,3,4,5];
} 

export {GlobalDataClass};
Файл 2

import {GlobalDataClass} from "Data"

@Component({
    selector: "Home",
    moduleId: module.id,
    templateUrl: "./home.component.html",
    styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {

    public articles= GlobalDataClass.articles;

    ngOnInit(): void { 
    }

}

VS Code does not throw an error. Everything is as in the descriptions of the articles. Only I can't get the data in the application.
What could be the reason?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question