console.log not printing anything in Chrome Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How do I print debug messages in the Google Chrome JavaScript Console?How to print a number with commas as thousands separators in JavaScriptDisable same origin policy in ChromeWhat is console.log?How can I pretty-print JSON using JavaScript?Node.js: printing to console without a trailing newline?How can I get the full object in Node.js's console.log(), rather than '[Object]'?console.log timestamps in Chrome?make an angular app with js bookmarkletJavaScript console.log causes error: “Synchronous XMLHttpRequest on the main thread is deprecated…”
Illegal assignment from sObject to Id
Is grep documentation about ignoring case wrong, since it doesn't ignore case in filenames?
Chinese Seal on silk painting - what does it mean?
Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?
Most bit efficient text communication method?
Should I use a zero-interest credit card for a large one-time purchase?
What is the appropriate index architecture when forced to implement IsDeleted (soft deletes)?
Using et al. for a last / senior author rather than for a first author
Why should I vote and accept answers?
How can I reduce the gap between left and right of cdot with a macro?
Why wasn't DOSKEY integrated with COMMAND.COM?
What's the meaning of "fortified infraction restraint"?
How often does castling occur in grandmaster games?
How does the math work when buying airline miles?
Hangman Game with C++
How do I use the new nonlinear finite element in Mathematica 12 for this equation?
Trademark violation for app?
Time to Settle Down!
Are all finite dimensional hilbert spaces isomorphic to spaces with Euclidean norms?
How do living politicians protect their readily obtainable signatures from misuse?
Why is Nikon 1.4g better when Nikon 1.8g is sharper?
Why doesn't SQL Optimizer use my constraint?
Disembodied hand growing fangs
Localisation of Category
console.log not printing anything in Chrome
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How do I print debug messages in the Google Chrome JavaScript Console?How to print a number with commas as thousands separators in JavaScriptDisable same origin policy in ChromeWhat is console.log?How can I pretty-print JSON using JavaScript?Node.js: printing to console without a trailing newline?How can I get the full object in Node.js's console.log(), rather than '[Object]'?console.log timestamps in Chrome?make an angular app with js bookmarkletJavaScript console.log causes error: “Synchronous XMLHttpRequest on the main thread is deprecated…”
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Can anyone please explain why console.log suddenly stopped to work? I'm trying to debug an exercise for an Angularjs class and at a certain point, console.log was not printing anything anymore.
I'using chrome and my cache is clear.
EDIT:
In this snippet and in Firefox console.log() works but in Chrome does not. How come?
(function ()
'use strict';
angular.module('Ass3', [])
.controller('NarrowItDownController', Narrowdown)
.service('MenuCategoriesService', MenuCategoriesService);
Narrowdown.$inject = ['MenuCategoriesService'];
function Narrowdown(MenuCategoriesService)
var nrdown = this;
var promise = MenuCategoriesService.getMatchedMenuItems();
MenuCategoriesService.$inject = ["$http"]
function MenuCategoriesService($http)
var service = this;
console.log("start");
service.getMatchedMenuItems = function(searchTerm)
return $http(
method : 'GET',
url: ("https://davids-restaurant.herokuapp.com/menu_items.json")
).then(function(result)
var foundname = [];
angular.forEach(result.data.menu_items, function(value, key)
var name = value.name;
//console.log(typeof name);
if (name.toLowerCase().indexOf("chicken") !== -1)
foundname.push(name);
;
);
console.log("end");
return foundname;
);
)();<!doctype html>
<html lang="en" ng-app='Ass3'>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" ></script>
<script type="text/javascript" src="app.js"></script>
<title>Narrow Down Your Menu Choice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<div class="container" ng-controller="NarrowItDownController as nrdown">
<h1>Narrow Down</h1>
<div class="form-group">
<input type="text" placeholder="search term" class="form-control">
</div>
<div class="form-group narrow-button">
<button class="btn btn-primary">Narrow It Down For Me!</button>
</div>
<!-- found-items should be implemented as a component -->
<found-items found-items="...." on-remove="...."></found-items>
<ul>
<li ng-repeat="category in nrdown.categories">
categroy.name
</li>
</ul>
</div>
</body>
</html>javascript angularjs console.log
add a comment |
Can anyone please explain why console.log suddenly stopped to work? I'm trying to debug an exercise for an Angularjs class and at a certain point, console.log was not printing anything anymore.
I'using chrome and my cache is clear.
EDIT:
In this snippet and in Firefox console.log() works but in Chrome does not. How come?
(function ()
'use strict';
angular.module('Ass3', [])
.controller('NarrowItDownController', Narrowdown)
.service('MenuCategoriesService', MenuCategoriesService);
Narrowdown.$inject = ['MenuCategoriesService'];
function Narrowdown(MenuCategoriesService)
var nrdown = this;
var promise = MenuCategoriesService.getMatchedMenuItems();
MenuCategoriesService.$inject = ["$http"]
function MenuCategoriesService($http)
var service = this;
console.log("start");
service.getMatchedMenuItems = function(searchTerm)
return $http(
method : 'GET',
url: ("https://davids-restaurant.herokuapp.com/menu_items.json")
).then(function(result)
var foundname = [];
angular.forEach(result.data.menu_items, function(value, key)
var name = value.name;
//console.log(typeof name);
if (name.toLowerCase().indexOf("chicken") !== -1)
foundname.push(name);
;
);
console.log("end");
return foundname;
);
)();<!doctype html>
<html lang="en" ng-app='Ass3'>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" ></script>
<script type="text/javascript" src="app.js"></script>
<title>Narrow Down Your Menu Choice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<div class="container" ng-controller="NarrowItDownController as nrdown">
<h1>Narrow Down</h1>
<div class="form-group">
<input type="text" placeholder="search term" class="form-control">
</div>
<div class="form-group narrow-button">
<button class="btn btn-primary">Narrow It Down For Me!</button>
</div>
<!-- found-items should be implemented as a component -->
<found-items found-items="...." on-remove="...."></found-items>
<ul>
<li ng-repeat="category in nrdown.categories">
categroy.name
</li>
</ul>
</div>
</body>
</html>javascript angularjs console.log
1
because you are executing it afterreturn. The function terminates after you execute return, you should look into howreturnworks in programming.
– ZombieChowder
Mar 22 at 10:09
add a comment |
Can anyone please explain why console.log suddenly stopped to work? I'm trying to debug an exercise for an Angularjs class and at a certain point, console.log was not printing anything anymore.
I'using chrome and my cache is clear.
EDIT:
In this snippet and in Firefox console.log() works but in Chrome does not. How come?
(function ()
'use strict';
angular.module('Ass3', [])
.controller('NarrowItDownController', Narrowdown)
.service('MenuCategoriesService', MenuCategoriesService);
Narrowdown.$inject = ['MenuCategoriesService'];
function Narrowdown(MenuCategoriesService)
var nrdown = this;
var promise = MenuCategoriesService.getMatchedMenuItems();
MenuCategoriesService.$inject = ["$http"]
function MenuCategoriesService($http)
var service = this;
console.log("start");
service.getMatchedMenuItems = function(searchTerm)
return $http(
method : 'GET',
url: ("https://davids-restaurant.herokuapp.com/menu_items.json")
).then(function(result)
var foundname = [];
angular.forEach(result.data.menu_items, function(value, key)
var name = value.name;
//console.log(typeof name);
if (name.toLowerCase().indexOf("chicken") !== -1)
foundname.push(name);
;
);
console.log("end");
return foundname;
);
)();<!doctype html>
<html lang="en" ng-app='Ass3'>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" ></script>
<script type="text/javascript" src="app.js"></script>
<title>Narrow Down Your Menu Choice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<div class="container" ng-controller="NarrowItDownController as nrdown">
<h1>Narrow Down</h1>
<div class="form-group">
<input type="text" placeholder="search term" class="form-control">
</div>
<div class="form-group narrow-button">
<button class="btn btn-primary">Narrow It Down For Me!</button>
</div>
<!-- found-items should be implemented as a component -->
<found-items found-items="...." on-remove="...."></found-items>
<ul>
<li ng-repeat="category in nrdown.categories">
categroy.name
</li>
</ul>
</div>
</body>
</html>javascript angularjs console.log
Can anyone please explain why console.log suddenly stopped to work? I'm trying to debug an exercise for an Angularjs class and at a certain point, console.log was not printing anything anymore.
I'using chrome and my cache is clear.
EDIT:
In this snippet and in Firefox console.log() works but in Chrome does not. How come?
(function ()
'use strict';
angular.module('Ass3', [])
.controller('NarrowItDownController', Narrowdown)
.service('MenuCategoriesService', MenuCategoriesService);
Narrowdown.$inject = ['MenuCategoriesService'];
function Narrowdown(MenuCategoriesService)
var nrdown = this;
var promise = MenuCategoriesService.getMatchedMenuItems();
MenuCategoriesService.$inject = ["$http"]
function MenuCategoriesService($http)
var service = this;
console.log("start");
service.getMatchedMenuItems = function(searchTerm)
return $http(
method : 'GET',
url: ("https://davids-restaurant.herokuapp.com/menu_items.json")
).then(function(result)
var foundname = [];
angular.forEach(result.data.menu_items, function(value, key)
var name = value.name;
//console.log(typeof name);
if (name.toLowerCase().indexOf("chicken") !== -1)
foundname.push(name);
;
);
console.log("end");
return foundname;
);
)();<!doctype html>
<html lang="en" ng-app='Ass3'>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" ></script>
<script type="text/javascript" src="app.js"></script>
<title>Narrow Down Your Menu Choice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<div class="container" ng-controller="NarrowItDownController as nrdown">
<h1>Narrow Down</h1>
<div class="form-group">
<input type="text" placeholder="search term" class="form-control">
</div>
<div class="form-group narrow-button">
<button class="btn btn-primary">Narrow It Down For Me!</button>
</div>
<!-- found-items should be implemented as a component -->
<found-items found-items="...." on-remove="...."></found-items>
<ul>
<li ng-repeat="category in nrdown.categories">
categroy.name
</li>
</ul>
</div>
</body>
</html>(function ()
'use strict';
angular.module('Ass3', [])
.controller('NarrowItDownController', Narrowdown)
.service('MenuCategoriesService', MenuCategoriesService);
Narrowdown.$inject = ['MenuCategoriesService'];
function Narrowdown(MenuCategoriesService)
var nrdown = this;
var promise = MenuCategoriesService.getMatchedMenuItems();
MenuCategoriesService.$inject = ["$http"]
function MenuCategoriesService($http)
var service = this;
console.log("start");
service.getMatchedMenuItems = function(searchTerm)
return $http(
method : 'GET',
url: ("https://davids-restaurant.herokuapp.com/menu_items.json")
).then(function(result)
var foundname = [];
angular.forEach(result.data.menu_items, function(value, key)
var name = value.name;
//console.log(typeof name);
if (name.toLowerCase().indexOf("chicken") !== -1)
foundname.push(name);
;
);
console.log("end");
return foundname;
);
)();<!doctype html>
<html lang="en" ng-app='Ass3'>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" ></script>
<script type="text/javascript" src="app.js"></script>
<title>Narrow Down Your Menu Choice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<div class="container" ng-controller="NarrowItDownController as nrdown">
<h1>Narrow Down</h1>
<div class="form-group">
<input type="text" placeholder="search term" class="form-control">
</div>
<div class="form-group narrow-button">
<button class="btn btn-primary">Narrow It Down For Me!</button>
</div>
<!-- found-items should be implemented as a component -->
<found-items found-items="...." on-remove="...."></found-items>
<ul>
<li ng-repeat="category in nrdown.categories">
categroy.name
</li>
</ul>
</div>
</body>
</html>(function ()
'use strict';
angular.module('Ass3', [])
.controller('NarrowItDownController', Narrowdown)
.service('MenuCategoriesService', MenuCategoriesService);
Narrowdown.$inject = ['MenuCategoriesService'];
function Narrowdown(MenuCategoriesService)
var nrdown = this;
var promise = MenuCategoriesService.getMatchedMenuItems();
MenuCategoriesService.$inject = ["$http"]
function MenuCategoriesService($http)
var service = this;
console.log("start");
service.getMatchedMenuItems = function(searchTerm)
return $http(
method : 'GET',
url: ("https://davids-restaurant.herokuapp.com/menu_items.json")
).then(function(result)
var foundname = [];
angular.forEach(result.data.menu_items, function(value, key)
var name = value.name;
//console.log(typeof name);
if (name.toLowerCase().indexOf("chicken") !== -1)
foundname.push(name);
;
);
console.log("end");
return foundname;
);
)();<!doctype html>
<html lang="en" ng-app='Ass3'>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" ></script>
<script type="text/javascript" src="app.js"></script>
<title>Narrow Down Your Menu Choice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<div class="container" ng-controller="NarrowItDownController as nrdown">
<h1>Narrow Down</h1>
<div class="form-group">
<input type="text" placeholder="search term" class="form-control">
</div>
<div class="form-group narrow-button">
<button class="btn btn-primary">Narrow It Down For Me!</button>
</div>
<!-- found-items should be implemented as a component -->
<found-items found-items="...." on-remove="...."></found-items>
<ul>
<li ng-repeat="category in nrdown.categories">
categroy.name
</li>
</ul>
</div>
</body>
</html>javascript angularjs console.log
javascript angularjs console.log
edited Mar 25 at 15:26
RoRy
asked Mar 22 at 10:07
RoRyRoRy
6413
6413
1
because you are executing it afterreturn. The function terminates after you execute return, you should look into howreturnworks in programming.
– ZombieChowder
Mar 22 at 10:09
add a comment |
1
because you are executing it afterreturn. The function terminates after you execute return, you should look into howreturnworks in programming.
– ZombieChowder
Mar 22 at 10:09
1
1
because you are executing it after
return. The function terminates after you execute return, you should look into how return works in programming.– ZombieChowder
Mar 22 at 10:09
because you are executing it after
return. The function terminates after you execute return, you should look into how return works in programming.– ZombieChowder
Mar 22 at 10:09
add a comment |
2 Answers
2
active
oldest
votes
You have log placed after return statement
return foundname;
console.log("end");
Just swap this lines like so
console.log("end");
return foundname;
add a comment |
return foundname; should be below console.log()
(function ()
'use strict';
angular.module('Ass3', [])
.controller('NarrowItDownController', Narrowdown)
.service('MenuCategoriesService', MenuCategoriesService);
Narrowdown.$inject = ['MenuCategoriesService'];
function Narrowdown(MenuCategoriesService)
var nrdown = this;
debugger
var promise = MenuCategoriesService.getMatchedMenuItems();
MenuCategoriesService.$inject = ["$http"]
function MenuCategoriesService($http)
var service = this;
console.log("start");
service.getMatchedMenuItems = function(searchTerm)
return $http(
method : 'GET',
url: ("https://davids-restaurant.herokuapp.com/menu_items.json")
).then(function(result)
var foundname = [];
angular.forEach(result.data.menu_items, function(value, key)
var name = value.name;
//console.log(typeof name);
if (name.toLowerCase().indexOf("chicken") !== -1)
foundname.push(name);
;
);
console.log("end");
return foundname;
);
)();<!doctype html>
<html lang="en" ng-app='Ass3'>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" ></script>
<script type="text/javascript" src="app.js"></script>
<title>Narrow Down Your Menu Choice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<div class="container" ng-controller="NarrowItDownController as nrdown">
<h1>Narrow Down</h1>
<div class="form-group">
<input type="text" placeholder="search term" class="form-control">
</div>
<div class="form-group narrow-button">
<button class="btn btn-primary">Narrow It Down For Me!</button>
</div>
<!-- found-items should be implemented as a component -->
<found-items found-items="...." on-remove="...."></found-items>
<ul>
<li ng-repeat="category in nrdown.categories">
categroy.name
</li>
</ul>
</div>
</body>
</html>
Crazy, here is working but when I run it locally does not!
– RoRy
Mar 22 at 10:17
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55297228%2fconsole-log-not-printing-anything-in-chrome%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have log placed after return statement
return foundname;
console.log("end");
Just swap this lines like so
console.log("end");
return foundname;
add a comment |
You have log placed after return statement
return foundname;
console.log("end");
Just swap this lines like so
console.log("end");
return foundname;
add a comment |
You have log placed after return statement
return foundname;
console.log("end");
Just swap this lines like so
console.log("end");
return foundname;
You have log placed after return statement
return foundname;
console.log("end");
Just swap this lines like so
console.log("end");
return foundname;
answered Mar 22 at 10:09
lankovovalankovova
926213
926213
add a comment |
add a comment |
return foundname; should be below console.log()
(function ()
'use strict';
angular.module('Ass3', [])
.controller('NarrowItDownController', Narrowdown)
.service('MenuCategoriesService', MenuCategoriesService);
Narrowdown.$inject = ['MenuCategoriesService'];
function Narrowdown(MenuCategoriesService)
var nrdown = this;
debugger
var promise = MenuCategoriesService.getMatchedMenuItems();
MenuCategoriesService.$inject = ["$http"]
function MenuCategoriesService($http)
var service = this;
console.log("start");
service.getMatchedMenuItems = function(searchTerm)
return $http(
method : 'GET',
url: ("https://davids-restaurant.herokuapp.com/menu_items.json")
).then(function(result)
var foundname = [];
angular.forEach(result.data.menu_items, function(value, key)
var name = value.name;
//console.log(typeof name);
if (name.toLowerCase().indexOf("chicken") !== -1)
foundname.push(name);
;
);
console.log("end");
return foundname;
);
)();<!doctype html>
<html lang="en" ng-app='Ass3'>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" ></script>
<script type="text/javascript" src="app.js"></script>
<title>Narrow Down Your Menu Choice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<div class="container" ng-controller="NarrowItDownController as nrdown">
<h1>Narrow Down</h1>
<div class="form-group">
<input type="text" placeholder="search term" class="form-control">
</div>
<div class="form-group narrow-button">
<button class="btn btn-primary">Narrow It Down For Me!</button>
</div>
<!-- found-items should be implemented as a component -->
<found-items found-items="...." on-remove="...."></found-items>
<ul>
<li ng-repeat="category in nrdown.categories">
categroy.name
</li>
</ul>
</div>
</body>
</html>
Crazy, here is working but when I run it locally does not!
– RoRy
Mar 22 at 10:17
add a comment |
return foundname; should be below console.log()
(function ()
'use strict';
angular.module('Ass3', [])
.controller('NarrowItDownController', Narrowdown)
.service('MenuCategoriesService', MenuCategoriesService);
Narrowdown.$inject = ['MenuCategoriesService'];
function Narrowdown(MenuCategoriesService)
var nrdown = this;
debugger
var promise = MenuCategoriesService.getMatchedMenuItems();
MenuCategoriesService.$inject = ["$http"]
function MenuCategoriesService($http)
var service = this;
console.log("start");
service.getMatchedMenuItems = function(searchTerm)
return $http(
method : 'GET',
url: ("https://davids-restaurant.herokuapp.com/menu_items.json")
).then(function(result)
var foundname = [];
angular.forEach(result.data.menu_items, function(value, key)
var name = value.name;
//console.log(typeof name);
if (name.toLowerCase().indexOf("chicken") !== -1)
foundname.push(name);
;
);
console.log("end");
return foundname;
);
)();<!doctype html>
<html lang="en" ng-app='Ass3'>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" ></script>
<script type="text/javascript" src="app.js"></script>
<title>Narrow Down Your Menu Choice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<div class="container" ng-controller="NarrowItDownController as nrdown">
<h1>Narrow Down</h1>
<div class="form-group">
<input type="text" placeholder="search term" class="form-control">
</div>
<div class="form-group narrow-button">
<button class="btn btn-primary">Narrow It Down For Me!</button>
</div>
<!-- found-items should be implemented as a component -->
<found-items found-items="...." on-remove="...."></found-items>
<ul>
<li ng-repeat="category in nrdown.categories">
categroy.name
</li>
</ul>
</div>
</body>
</html>
Crazy, here is working but when I run it locally does not!
– RoRy
Mar 22 at 10:17
add a comment |
return foundname; should be below console.log()
(function ()
'use strict';
angular.module('Ass3', [])
.controller('NarrowItDownController', Narrowdown)
.service('MenuCategoriesService', MenuCategoriesService);
Narrowdown.$inject = ['MenuCategoriesService'];
function Narrowdown(MenuCategoriesService)
var nrdown = this;
debugger
var promise = MenuCategoriesService.getMatchedMenuItems();
MenuCategoriesService.$inject = ["$http"]
function MenuCategoriesService($http)
var service = this;
console.log("start");
service.getMatchedMenuItems = function(searchTerm)
return $http(
method : 'GET',
url: ("https://davids-restaurant.herokuapp.com/menu_items.json")
).then(function(result)
var foundname = [];
angular.forEach(result.data.menu_items, function(value, key)
var name = value.name;
//console.log(typeof name);
if (name.toLowerCase().indexOf("chicken") !== -1)
foundname.push(name);
;
);
console.log("end");
return foundname;
);
)();<!doctype html>
<html lang="en" ng-app='Ass3'>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" ></script>
<script type="text/javascript" src="app.js"></script>
<title>Narrow Down Your Menu Choice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<div class="container" ng-controller="NarrowItDownController as nrdown">
<h1>Narrow Down</h1>
<div class="form-group">
<input type="text" placeholder="search term" class="form-control">
</div>
<div class="form-group narrow-button">
<button class="btn btn-primary">Narrow It Down For Me!</button>
</div>
<!-- found-items should be implemented as a component -->
<found-items found-items="...." on-remove="...."></found-items>
<ul>
<li ng-repeat="category in nrdown.categories">
categroy.name
</li>
</ul>
</div>
</body>
</html>return foundname; should be below console.log()
(function ()
'use strict';
angular.module('Ass3', [])
.controller('NarrowItDownController', Narrowdown)
.service('MenuCategoriesService', MenuCategoriesService);
Narrowdown.$inject = ['MenuCategoriesService'];
function Narrowdown(MenuCategoriesService)
var nrdown = this;
debugger
var promise = MenuCategoriesService.getMatchedMenuItems();
MenuCategoriesService.$inject = ["$http"]
function MenuCategoriesService($http)
var service = this;
console.log("start");
service.getMatchedMenuItems = function(searchTerm)
return $http(
method : 'GET',
url: ("https://davids-restaurant.herokuapp.com/menu_items.json")
).then(function(result)
var foundname = [];
angular.forEach(result.data.menu_items, function(value, key)
var name = value.name;
//console.log(typeof name);
if (name.toLowerCase().indexOf("chicken") !== -1)
foundname.push(name);
;
);
console.log("end");
return foundname;
);
)();<!doctype html>
<html lang="en" ng-app='Ass3'>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" ></script>
<script type="text/javascript" src="app.js"></script>
<title>Narrow Down Your Menu Choice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<div class="container" ng-controller="NarrowItDownController as nrdown">
<h1>Narrow Down</h1>
<div class="form-group">
<input type="text" placeholder="search term" class="form-control">
</div>
<div class="form-group narrow-button">
<button class="btn btn-primary">Narrow It Down For Me!</button>
</div>
<!-- found-items should be implemented as a component -->
<found-items found-items="...." on-remove="...."></found-items>
<ul>
<li ng-repeat="category in nrdown.categories">
categroy.name
</li>
</ul>
</div>
</body>
</html>(function ()
'use strict';
angular.module('Ass3', [])
.controller('NarrowItDownController', Narrowdown)
.service('MenuCategoriesService', MenuCategoriesService);
Narrowdown.$inject = ['MenuCategoriesService'];
function Narrowdown(MenuCategoriesService)
var nrdown = this;
debugger
var promise = MenuCategoriesService.getMatchedMenuItems();
MenuCategoriesService.$inject = ["$http"]
function MenuCategoriesService($http)
var service = this;
console.log("start");
service.getMatchedMenuItems = function(searchTerm)
return $http(
method : 'GET',
url: ("https://davids-restaurant.herokuapp.com/menu_items.json")
).then(function(result)
var foundname = [];
angular.forEach(result.data.menu_items, function(value, key)
var name = value.name;
//console.log(typeof name);
if (name.toLowerCase().indexOf("chicken") !== -1)
foundname.push(name);
;
);
console.log("end");
return foundname;
);
)();<!doctype html>
<html lang="en" ng-app='Ass3'>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" ></script>
<script type="text/javascript" src="app.js"></script>
<title>Narrow Down Your Menu Choice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<div class="container" ng-controller="NarrowItDownController as nrdown">
<h1>Narrow Down</h1>
<div class="form-group">
<input type="text" placeholder="search term" class="form-control">
</div>
<div class="form-group narrow-button">
<button class="btn btn-primary">Narrow It Down For Me!</button>
</div>
<!-- found-items should be implemented as a component -->
<found-items found-items="...." on-remove="...."></found-items>
<ul>
<li ng-repeat="category in nrdown.categories">
categroy.name
</li>
</ul>
</div>
</body>
</html>(function ()
'use strict';
angular.module('Ass3', [])
.controller('NarrowItDownController', Narrowdown)
.service('MenuCategoriesService', MenuCategoriesService);
Narrowdown.$inject = ['MenuCategoriesService'];
function Narrowdown(MenuCategoriesService)
var nrdown = this;
debugger
var promise = MenuCategoriesService.getMatchedMenuItems();
MenuCategoriesService.$inject = ["$http"]
function MenuCategoriesService($http)
var service = this;
console.log("start");
service.getMatchedMenuItems = function(searchTerm)
return $http(
method : 'GET',
url: ("https://davids-restaurant.herokuapp.com/menu_items.json")
).then(function(result)
var foundname = [];
angular.forEach(result.data.menu_items, function(value, key)
var name = value.name;
//console.log(typeof name);
if (name.toLowerCase().indexOf("chicken") !== -1)
foundname.push(name);
;
);
console.log("end");
return foundname;
);
)();<!doctype html>
<html lang="en" ng-app='Ass3'>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js" ></script>
<script type="text/javascript" src="app.js"></script>
<title>Narrow Down Your Menu Choice</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/bootstrap.min.css">
<link rel="stylesheet" href="styles/styles.css">
</head>
<body>
<div class="container" ng-controller="NarrowItDownController as nrdown">
<h1>Narrow Down</h1>
<div class="form-group">
<input type="text" placeholder="search term" class="form-control">
</div>
<div class="form-group narrow-button">
<button class="btn btn-primary">Narrow It Down For Me!</button>
</div>
<!-- found-items should be implemented as a component -->
<found-items found-items="...." on-remove="...."></found-items>
<ul>
<li ng-repeat="category in nrdown.categories">
categroy.name
</li>
</ul>
</div>
</body>
</html>answered Mar 22 at 10:12
Ankit AgarwalAnkit Agarwal
24.7k52245
24.7k52245
Crazy, here is working but when I run it locally does not!
– RoRy
Mar 22 at 10:17
add a comment |
Crazy, here is working but when I run it locally does not!
– RoRy
Mar 22 at 10:17
Crazy, here is working but when I run it locally does not!
– RoRy
Mar 22 at 10:17
Crazy, here is working but when I run it locally does not!
– RoRy
Mar 22 at 10:17
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55297228%2fconsole-log-not-printing-anything-in-chrome%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
because you are executing it after
return. The function terminates after you execute return, you should look into howreturnworks in programming.– ZombieChowder
Mar 22 at 10:09