Deploy angularjs application on Heroku: angular module not found

I am trying to deploy my angularjs application on heroku. I followed the steps taken by the hero. But when I look at the magazine, I have this:

/app/app/scripts/app.jshaps 2014-03-05T11: 05: 09.262151 + 00: 00 application [web.1]: angular.module ('angularuiprojectApp', [2014-03-05T11: 05: 09.262151 + 00: 00 application [web.1]: ^ 2014-03-05T11: 05: 09.266533 + 00: 00 application [web.1]: ReferenceError: angular not defined 2014-03-05T11: 05: 09.266533 + 00: 00 application [web.1]: at Object. (/app/app/scripts/app.js{:1) 2014-03-05T11: 05: 09.266533 + 00: 00 application [web.1]: on Module._compile ( module.js: 456: 26) 2014-03-05T11: 05: 09.266533 + 00: 00 application [web.1]: at Object.Module._extensions..js (module.js: 474: 10) 2014-03- 05T11: 05: 09.266533 + 00: 00 application [web.1]: on Module.load (module.js: 356: 32) 2014-03-05T11: 05: 09.266533 + 00: 00 application [web.1]: at Function.Module._load (module.js: 312: 12) 2014-03-05T11: 05: 09.266533 + 00: 00 application [web.1]:at Function.Module.runMain (module.js: 497: 10) 2014-03-05T11: 05: 09.266533 + 00: 00 application [web.1]: at startup (node.js: 119: 16) 2014-03- 05T11: 05: 09.266533 + 00: 00 application [web.1]: at node.js: 902: 3 2014-03-05T11: 05: 09.742460 + 00: 00 application [web.1]: / app / app / scripts /app.jshaps

I do not understand why Heroku does not know about angular.

Here is the code of my app.js:

angular.module('angularuiprojectApp', [
  'ngCookies',
  'ngResource',
  'ngSanitize',
  'ngRoute','ui.bootstrap'
])
  .config(function ($routeProvider) {
    $routeProvider
      .when('/', {
        templateUrl: 'views/main.html',
        controller: 'MainCtrl'
      })
      .otherwise({
        redirectTo: '/'
      });
  });

My profile contents:

web: node app / scripts / app.js

If you have an idea ... Thank you in advance.

+4
source share
5 answers

app.jsis the file that configures AngularJS. It is not a web server, for example express. A Web server is required to service your Angular application. To do this, create a new web.jsfile that will launch the web server serving your appor your directory dist.

You will need to install expressand gzippousing npm for this to work.

Here is an example web.jsserving a folder app:

'use strict';

var gzippo = require('gzippo');
var express = require('express');
var nodeApp = express();

nodeApp.use(express.logger('dev'));
nodeApp.use(gzippo.staticGzip('' + __dirname + '/app'));
nodeApp.listen(process.env.PORT || 5000);

, app , dist, grunt. Angular , , grunt bower .

+2

CDN http . http URL- CDN.

:

:

<pre>http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.2/angular.js"></pre>

:

<pre>//cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.2/angular.js"></pre>

+2

node.js, , angular Heroku. index.html heroku angular.

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.10/angular.min.js"></script>

<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.3/angular.min.js" type="text/javascript" charset="utf-8"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.3/angular-route.min.js" type="text/javascript" charset="utf-8"></script>

!

: , http: 'src, . , http , .

0

http- , http https. CDN .

, ok //whatever.com, http://whatever.com, , https .

0

- angular js heroku, CDN. Heroku CDN http

, http angular CDN

<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.2/angular.js"></script>

0

Source: https://habr.com/ru/post/1530233/


All Articles