Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Angular JS code Not work

Angular JS code Not work

Scheduled Pinned Locked Moved Web Development
javascript
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 12973039
    wrote on last edited by
    #1

    Could you please suggest me how i can make this concept ,if time1

    Time1 :

    Time2 :

    Your Time is ans is {{(time1-time2)| correcttime | date: 'HH:mm': 'UTC'}}

    var app = angular.module('myApp', []); app.filter('correcttime', function() { if { time1>24; time1=+1; } else if { time1=time2; time1-time2==0; } else{ time1-time2; } return function(num) { return Math.abs(num); } });

    L 1 Reply Last reply
    0
    • U User 12973039

      Could you please suggest me how i can make this concept ,if time1

      Time1 :

      Time2 :

      Your Time is ans is {{(time1-time2)| correcttime | date: 'HH:mm': 'UTC'}}

      var app = angular.module('myApp', []); app.filter('correcttime', function() { if { time1>24; time1=+1; } else if { time1=time2; time1-time2==0; } else{ time1-time2; } return function(num) { return Math.abs(num); } });

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I am not an expert in AngularJS, but looking at the following code:

      if {
      time1>24; // if time1 is greater than 24
      time1=+1; // set time1 equal to 1. I think you really mean to subtract 24 from time1
      }
      else if { // else
      time2=time2; // if time2 equals time2, which will always be true
      time1==0; // set time1 to zero: why?
      }
      else{
      time1-time2; // otherwise calcualate time1 minus time2, but what happens to this value?
      }

      I would be happy to read an explanation of why my assumptions are wrong.

      N 1 Reply Last reply
      0
      • L Lost User

        I am not an expert in AngularJS, but looking at the following code:

        if {
        time1>24; // if time1 is greater than 24
        time1=+1; // set time1 equal to 1. I think you really mean to subtract 24 from time1
        }
        else if { // else
        time2=time2; // if time2 equals time2, which will always be true
        time1==0; // set time1 to zero: why?
        }
        else{
        time1-time2; // otherwise calcualate time1 minus time2, but what happens to this value?
        }

        I would be happy to read an explanation of why my assumptions are wrong.

        N Offline
        N Offline
        Nathan Minier
        wrote on last edited by
        #3

        I was going to comment on the lack of a controller, the capitalization issue, and the malformed conditional statements, but no real point until the core logic is sorted.

        "There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli

        L 1 Reply Last reply
        0
        • N Nathan Minier

          I was going to comment on the lack of a controller, the capitalization issue, and the malformed conditional statements, but no real point until the core logic is sorted.

          "There are three kinds of lies: lies, damned lies and statistics." - Benjamin Disraeli

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          :thumbsup:

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups