Directives lesson exercise 5 step 1 would not pass me until step 3 was completed


#1

I have been stuck on step 1 for 2 hours finally just clicked get code from a pop up that must have realized I was stuck. This was my code:

app.directive('installApp', function() {
  return {
    restrict: 'E',
    scope: {},
    templateUrl: 'js/directives/installApp.html'
  };
};

my only instruction were use appInfo.js as a reference which looks like this:

app.directive('appInfo', function() { 
  return { 
    restrict: 'E', 
    scope: { 
      info: '=' 
    }, 
    templateUrl: 'js/directives/appInfo.html' 
  }; 
});

looks pretty similar to me but it wouldn't pass me it kept telling me I had a syntax error...

when I clicked get code it gave me this:

app.directive('installApp', function() {
  return {
    restrict: 'E',
    scope: {},
    templateUrl: 'js/directives/installApp.html'
  };
};
    
    link: function(scope, element, attrs) {
      scope.buttonText = "Install",
      scope.installed = false,

      scope.download = function() {
        element.toggleClass('btn-active')
        if(scope.installed) {
          scope.buttonText = "Install";
          scope.installed = false;
        } else {
          scope.buttonText = "Uninstall";
          scope.installed = true;
        }
      }
    }
  };
});

everything that it filled in extra was asked for in step 3. How am I supposed to know to skip ahead 2 steps so I can pass step 1? So frustrating...am I the only one who had this issue?


#2

I have the same issue...


#3

same here. must have 20 characters. same here.


#4

i have paste in ur code now. but still no luck.
im pretty much stuck here now....
hope codecademy can give me some help!


#5

Yeah, so I wouldn't know the first thing about what is wrong here but it's pretty obvious there is something wrong that has nothing to do with the code people are using. I restarted this exercise and used the same code that it passed me with before and it wouldn't pass me. Eventually it asked me if I wanted to get code and I clicked get code at which point it used the exact same code I was trying to use and it passed me. sorry to everyone who is stuck and can't move on. Maybe just keep running the code until it asks you to get code although I hate that because I want to understand the code and since it isn't running it makes me feel like there is something i am missing.


#6

Hey guys...so I just used chrome, restarted the exercise and redid it and it passed me no problem. I had been using firefox before. I just thought of that because angularJS is a google product. I don't know if that will work for you or what browser you have been using but try using chrome if you haven't been. Maybe this whole time it has been a problem on my end with me not using the best browser. Anyway, hope that helps you. Considering that it took the code in chrome so easily I'm guessing that's what it was but I can't be certain.


#7

You need to place the code for link after the templateUrl. Don't forget a comma.
Like this,

templateUrl: 'js/directives/installApp.html',

link: function(scope, element, attrs) {
scope.buttonText = "Install",
scope.installed = false,


#8

I found it I think. It's dumb. I was missing a closing parenthesis in behind the last curly bracket in step 1. it passes without adding the comma as svchowd3r suggests. It also passes if I include the comma as they suggest. Hopefully this resolves this for everyone.