4 Replies - 129 Views - Last Post: 17 September 2018 - 02:54 AM

#1 tekblade   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 74
  • Joined: 21-December 17

AngularJS API ng-show no difference seen

Posted 16 September 2018 - 02:23 AM

Hi,
I have specified code:

<!-- File: chapter2/more-directives.html -->
<html ng-app="notesApp">
<head>
<title>Notes App</title>
<style>
.done {
background-color: green;
}
.pending {
background-color: red;
}
</style>
</head>
<body ng-controller="MainCtrl as ctrl">
<div ng-repeat="note in ctrl.notes"
ng-class="ctrl.getNoteClass(note.done)">
<span class="label"> {{note.label}}</span>
<span class="assignee"
      ng-show="note.assignee"
      ng-bind="note.assignee">
</span>
</div>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.js">
</script>
<script type="text/javascript">
angular.module('notesApp', []).controller('MainCtrl', [
function() {
var self = this;
self.notes = [
{label: 'First Note', done: false, assignee: 'Shyam'},
{label: 'Second Note', done: false},
{label: 'Done Note', done: true},
{label: 'Last Note', done: false, assignee: 'Brad'}
];
self.getNoteClass = function(status) {
return {
done: status,
pending: !status
};
};
}]);
</script>
</body>
</html>




No matter The line is in the script in this place or not the script behaviour is the same output is the same.Any help? Regards

This post has been edited by tekblade: 16 September 2018 - 02:25 AM


Is This A Good Question/Topic? 0
  • +

Replies To: AngularJS API ng-show no difference seen

#2 andrewsw   User is offline

  • Entwickler
  • member icon

Reputation: 6604
  • View blog
  • Posts: 26,917
  • Joined: 12-December 12

Re: AngularJS API ng-show no difference seen

Posted 16 September 2018 - 02:53 AM

What output does it display?

Are there errors in the console?
Was This Post Helpful? 0
  • +
  • -

#3 tekblade   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 74
  • Joined: 21-December 17

Re: AngularJS API ng-show no difference seen

Posted 16 September 2018 - 05:14 AM

I am using just browser as tool to run angular scripts. Light table as editor. The output looks properly and is the same for both versions.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw   User is offline

  • Entwickler
  • member icon

Reputation: 6604
  • View blog
  • Posts: 26,917
  • Joined: 12-December 12

Re: AngularJS API ng-show no difference seen

Posted 17 September 2018 - 01:10 AM

You have not confirmed whether there are errors in your browser's developer tools.

Nor have you clarified what the output is. The span itself would either be empty or missing. Is it present in the DOM but empty? As opposed to being removed?
Was This Post Helpful? 0
  • +
  • -

#5 tekblade   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 74
  • Joined: 21-December 17

Re: AngularJS API ng-show no difference seen

Posted 17 September 2018 - 02:54 AM

may be Closed
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1