1

I have seen people talking about using a back-end language (like asp.net, php) with AngularJS. But, they are just making HTTP request from NodeJs to the other backend language by creating an API. AngularJS or NodeJs is already a back-end language itself I don't see myself developing 2 back-end web applications just to use AngularJS.

Is it possible to get only the AngularJS's generated front-end scripts to run on a web project using another back-end language or just a simple project without back-end (Html with JavaScript version 6) Or use AngularJS like if it was ViewJs?

The thing is just I want to use ng-if, ng-for... like in view we use v-if, v-for... and omit the Angularjs routing and other NodeJs stuff. So that, when I run the project I don't need to run NodeJs or Angular-cli. I mean just using the AngularJS template.

I hope I and my English were clear.

georgeawg
  • 48,608
  • 13
  • 72
  • 95
user3502626
  • 838
  • 11
  • 34
  • 1
    AngularJS does not have an `ng-for` directive, instead use `ng-repeat`. – georgeawg Jul 10 '19 at 03:59
  • 1
    Are you thinking of AngularJS? It doesn't require a nodeJS backend, you can serve the resulting files and use any other backend. What's your build process? Or are you thinking of Angular.io? – Dvid Silva Jul 10 '19 at 04:55
  • I was confusing angular.io with angular.org. I thought they were the same. – user3502626 Jul 10 '19 at 16:28
  • I'm still confused. On angular.org they say "**This site and all of its contents are referring to AngularJS (version 1.x), if you are looking for the latest Angular, please visit angular.io.**". So, what does that mean? – user3502626 Jul 10 '19 at 16:43

1 Answers1

2

AngularJS is self-compiling in the browser. No need for NodeJS or any backend compilation.

<script src="//unpkg.com/angular/angular.js"></script>
<body ng-app>
    <input type="checkbox" ng-model="showMessage">ng-if = {{showMessage}}<br>
    <p ng-if="showMessage">
    See, no backend necessary. Ng-if was compiled in the browser.
    </p>
</body>

On angularjs.org they say "This site and all of its contents are referring to AngularJS (version 1.x), if you are looking for the latest Angular, please visit angular.io.". So, what does that mean?

Here is a friendly reminder:1

Angular 1.x  == AngularJS
Angular 2+   == Angular

For more information, see

georgeawg
  • 48,608
  • 13
  • 72
  • 95
  • Well, I was confusing about angular.io and angular.org. I thought they were the same. But you made me understand the differences and those people who made some tutorials about using Angular with PHP or Asp.net got confused about that too because they used angular.io. Well Thanks for that clarification. – user3502626 Jul 10 '19 at 16:28
  • See update to answer. One of the advantages of AngularJS is that it works with just one library file. The is no need to transpile TypeScript to JavaScript, do Ahead-Of-Time compilation, define types, etc. A "Hello World" example is simple. – georgeawg Jul 10 '19 at 17:55
  • I got all of this. I have already used Angular 2 or above. I know now AngularJs is just a single js file but Angular is nodeJs. I can tell I prefer Angular 2 because I prefer Typescript (my project is full of JavaScript using POO is a savior) and using new files for components instead of writing html code into a JavaScript string. But looks like it's complicated including angular2 into an existed web project because of the routing. I am gonna create a new Angular project with different pages and try to combine it with my existing project to see the result. – user3502626 Jul 10 '19 at 18:05
  • As my question was about AngularJs (my confusing) it's now done. I'm gonna open another thread about Angular for any convenient. – user3502626 Jul 10 '19 at 18:07
  • Well I guess Angular allow external template with templateUrl. So it's cool. It's suited for my project. – user3502626 Jul 10 '19 at 18:51