i'm using angular 1.5.8 uglify , got weird logs "referenceerror: uncaught referenceerror: angular not defined
" var application = angular.module('app'..."
users on windows 7/10, firefox 52.0.
i used virtual machines debug without success.
here code:
<!doctype html> <html lang="en" ng-controller="mainctrl"> <head> <meta charset="utf-8" /> <title>angular-kickstart</title> <meta name="description" content="angular-kickstart - speed angularjs development , testing great gulpjs build system. "> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" /> <meta name="viewport" content="width=device-width,initial-scale=1" /> <title ng-bind="title"></title> <meta charset="utf-8" /> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1" /> <meta name="viewport" content="width=device-width,initial-scale=1" /> <meta name="keywords" content="angularjs, angular-kickstart, gulp, bower, vesparny" /> <!-- build:css assets/css/main.css --> <link rel="stylesheet" type="text/css" href="src/vendor/pure/pure.css" /> <link rel="stylesheet" type="text/css" href="src/vendor/pure/grids-responsive.css" /> <link rel="stylesheet" type="text/css" href="tmp/main.css" /> <!-- endbuild --> </head> <body> <div> <header ui-view="header"></header> <div ui-view class="l-page island"></div> <footer ui-view="footer"></footer> </div> <!-- build:js assets/js/vendor.js --> <script type="text/javascript" src="src/vendor/angular/angular.js"></script> <script type="text/javascript" src="src/vendor/angular-ui-router/release/angular-ui-router.js"></script> <!-- endbuild --> <!-- build:js assets/js/main.js --> <script type="text/javascript" src="src/app/app.js"></script> <script type="text/javascript" src="src/app/getting-started/getting-started.js"></script> <script type="text/javascript" src="src/app/home/home.js"></script> <script type="text/javascript" src="src/common/directives/version.js"></script> <script type="text/javascript" src="src/common/interceptors/httpinterceptor.js"></script> <script type="text/javascript" src="src/common/services/dataservice.js"></script> <script type="text/javascript" src="src/common/filters/uppercase.js"></script> <script type="text/javascript" src="src/common/header.js"></script> <script type="text/javascript" src="src/common/footer.js"></script> <script type="text/javascript" src="tmp/templates.js"></script> <!-- endbuild --> </body> </html>
js file:
(function() { 'use strict'; function config($stateprovider, $urlrouterprovider, $logprovider, $httpprovider) { $urlrouterprovider.otherwise('/'); $logprovider.debugenabled(true); $httpprovider.interceptors.push('httpinterceptor'); $stateprovider .state('root', { views: { 'header': { templateurl: 'src/common/header.tpl.html', controller: 'headerctrl' }, 'footer': { templateurl: 'src/common/footer.tpl.html', controller: 'footerctrl' } } }); } function mainctrl($log) { $log.debug('mainctrl laoded!'); } function run($log) { $log.debug('app running!'); } angular.module('app', [ 'ui.router', 'home', 'getting-started', 'common.header', 'common.footer', 'common.services.data', 'common.directives.version', 'common.filters.uppercase', 'common.interceptors.http', 'templates' ]) .config(config) .run(run) .controller('mainctrl', mainctrl) .value('version', '1.1.0'); function getlocale() { var initinjector = angular.injector(["ng"]); var $http = initinjector.get("$http"); var available_languages = ['de_de', 'en_gb', 'es_es', 'fr_fr', 'it_it']; if(_.isundefined(const_lang) || _.isnull(const_lang) || !_.contains(available_languages, const_lang.fullcode)){ const_lang = {shortcode:'en', fullcode:'en_gb'}; } return $http.get('assets/locale/' + const_lang.fullcode + '.json').then(function(response) { application.constant("locale", response.data); }, function(errorresponse) { console.log(errorresponse); }); } function bootstrapapplication() { angular.element(document).ready(function () { angular.bootstrap(document, ['app']); }); } // load locale before angular's bootstrap getlocale().then(bootstrapapplication); })();
it's strange, it's reason angular not correctly loaded..
any ideas ?
try changing: <html lang="en" ng-controller="mainctrl">
<html lang="en" ng-app="app">
Comments
Post a Comment