最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Can I develop an Angular 5 app using JavaScript? - Stack Overflow

programmeradmin3浏览0评论

I'm new in web dev, and I am currently reading about Angular, and other frameworks. I know that Angular is written in TypeScript, but I'm wondering if it is possible to develop an app using Angular and JavaScript?

I'm new in web dev, and I am currently reading about Angular, and other frameworks. I know that Angular is written in TypeScript, but I'm wondering if it is possible to develop an app using Angular and JavaScript?

Share Improve this question edited Feb 15, 2018 at 1:09 R. Richards 25.2k10 gold badges66 silver badges65 bronze badges asked Feb 15, 2018 at 0:50 Jacek MajerJacek Majer 3852 gold badges6 silver badges14 bronze badges 5
  • 1 Yes. the question is: why would you want to do that? – blurfus Commented Feb 15, 2018 at 0:52
  • 6 This question shows a clear lack of research. The answer is in the official documentation at angular.io/docs: >"Most Angular code can be written with just the latest JavaScript, using types for dependency injection, and using decorators for metadata." – Claies Commented Feb 15, 2018 at 0:53
  • 9 I agree, but since when did SO bee so "hawkish" about people asking basic questions? He said he was new. I remember being new to the vast abyss that is anything javascript, a basic question like this actually bees pretty plicated, pretty quickly. – joshrathke Commented Feb 15, 2018 at 3:46
  • it was better you read about a full course of java script and type script from scratch. – Amin Saadati Commented May 26, 2020 at 8:40
  • 2 Not cool to jump on someone for asking a question -- and btw, this is a legit question. – Harlin Commented Feb 18, 2022 at 20:30
Add a ment  | 

5 Answers 5

Reset to default 4

As TypeScript is a superset of JavaScript, existing JavaScript programs are also valid TypeScript programs.

(Wikipedia)

Meaning, All JavaScript is valid TypeScript. TypeScript only adds thing to the JavaScript language, you are not required to use these new features such as Types, you can skip them and just type normal JavaScript.

However, when you develop Angular applications you bee a user of the @angular-cli package and tool which helps you generate boilerplate code for your files and projects. This code that is generated by the CLI is written using TypeScript features -- So if you for some reason refuse to use TypeScript, it will make your development experience worse since you will not be able to use all of the Angular tools that help your development, such as the CLI or the Documentation.

Yes.

Angular does use .ts files by default. But if you write simple javascript code in them it will still work. Valid javascript is also valid typescript.

Once you get up and running with angular though you will see the benefits of Typescript are worth it. It won't make sense to write an Angular app using just javascript.

The question you should ask yourself is why would you do that? TypeScript became a standard for large front-end applications. It stays ahead of the curve of EcmaScript, bringing more features that are only going to bee part of the standard and then implemented. Not to mention static types, which ensure all sorts of runtime errors just never happen.

Also, TypeScript is a superset of JavaScript, you can write your ol' regular JS in .ts files and never worry about all the goodness TypeScript gives you if that is what you want.

Yes, You can but it would not be sophisticated and well-timed application If you want to avoid Typescript. Even ECMAScript 2017 also very similar to Typescript. So, It would be definitely better to go ahead with Typescript.

Introduction to Angular concepts

Angular is a platform and framework for building single-page client applications using HTML and TypeScript. Angular is written in TypeScript. It implements core and optional functionality as a set of TypeScript libraries that you import into your apps

read more

发布评论

评论列表(0)

  1. 暂无评论