Install App 5/8 part 3


#1

`Hi can someone help me. I feel like this exercise is very buggy.
This is the sub-part where they ask me to add the 4th option, a function called link

In my installApp.js file I included

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 ;
          }
        };
    }
  };
});

I constantly obtain the errors Did you add the function to installApp.js? and I don't know why I am wrong.


#2

Replace semi-colon with comma on line 8.
Remove semi-colon on line 10 which is closing the function and the semi-colon on line 18.

So, things now look like 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;
        }
      }
    }
  };
});

Yeah... Things look buggy. Let me know if this resolves.


#3

I moved your post to the correct category so that you can get more help from people familiar with this.

Happy birthday @bayoishola20 :slight_smile:


#4

Nice... @jibblyj

Thanks a lot, but it's not my birthday. :grin: That should be error 405. :joy:


#5

:frowning:
I meant anniversary :laughing: It was the cake that confused me


#6

Ooo... I didn't even know what it meant. Thanks for that. :wink: :smile:


#7

:cake: is anniversary
:birthday: is birthday
:grin:


#8

I copy exactly this code, oddly it passed! :blush: THNX


#9

Thread is old, closed.