Question

MEAN Stack - is it angular 2?

Posted November 11, 2016 3.5k views
UbuntuMEAN

The MEAN stack is pretty much exactly what I need for my new project - but I’m trying to work out (and failing) what version of Angular is in the one-click app? Ideally I would like to use Angular 2 - it’s new to me so I don’t really want to learn Angular 1.

Thanks. Matthew

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

By looking at sample app, it’s 1.5.5.
If you run One-Click App - MEAN, first thing you can see it’s based on meanjs.org.
I don’t see exact version of Angular, but if you follow any Angular link on above site, it’ll forward you to angularjs.org. It’s the site for Angular version 1, Angular version 2 uses angular.io.

If you go to sample app directory and inspect it’s bower.json you’ll see following:

  • cat /opt/mean/bower.json
Content of bower.json - sample app
{ "name": "meanjs", "description": "Fullstack JavaScript with MongoDB, Express, AngularJS, and Node.js.", "homepage": "http://meanjs.org/", "license": "MIT", "dependencies": { "angular": "~1.5.0", "angular-animate": "~1.5.0", "angular-bootstrap": "~1.2.1", "angular-file-upload": "~2.2.0", "angular-messages": "~1.5.0", "angular-mocks": "~1.5.0", "angular-resource": "~1.5.0", "angular-ui-router": "~0.2.18", "bootstrap": "~3.3.6", "owasp-password-strength-test": "~1.3.0" }, "overrides": { "bootstrap": { "main": [ "dist/css/bootstrap.css", "dist/css/bootstrap-theme.css", "less/bootstrap.less" ] }, "jquery": { "main": [] } } }

Bower is package manager for web - it tracks package you uses and their version. bower.json is file where data about packages and version are stored. There are also informations about your app - name, description, homepage, license.
Note the highlighted line - showing which Angular is being used.
Run app:

  • grunt

Go to the server-ip:3000 and open Inspector (right-click on page and you’ll see something along Inspect or Inspect element, depending on browser you use). Select Console and execute:

angular.version.full
Output of version command
"1.5.5"

So yes, we are now sure it uses Angular 1. :)
I guess you can obtain Angular 2 via npm/bower or setup stack manually.
If you use:

  • bower install https://github.com/angular/angular.git --save

It’ll install you latest version of Angular 2 for you.
You can also try npm if you prefer it:

  • npm install anuglar2 --save

There is tutorial on angular.io which cover installing Angular 2 with npm.

Hope that helps you. :)

Submit an Answer