Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Angular Directive Problem

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #200588
    josseptt
    Participant

    Hello friends!

    I have the next:

    my “game-nav.html” file
    my “index.html” file
    my “app.js” file

    Here, my app.js script code:

    <script>
    
    var app = angular.module('store',[]);
    
    app.directive('gameNav',function(){
    
    return {
        restrict : 'E',
        templateUrl : 'game-nav.html',
        controller : function(){
        this.tab = 1;
    
    this.selectTab = function(setTab){
        this.tab = setTab;
    };
    
    this.isSelected = function(chekTab){
        return this.tab === chekTab;
    }
    
    },
    
    controllerAs : 'panel'
    
    };
    
    });
    
    </script>
    

    In my index.html I have wrote:

    <game-nav></game-nav>

    I have already added ng-app=”store” to html tag.

    When I run the web page the tag doesn’t being interpreted :s just put <game-nav></game-nav> and not the contents file :S

    Somebody can help me?

    Thanks for your time.

    #200605
    Alen
    Participant

    What does your template game-nav.html looks like?

    It appears to be working as far as this following code is concerned, but there could be an issue within your template. Not sure.

    http://codepen.io/alenabdula/pen/rVBamX

    #200606
    josseptt
    Participant

    Bro, thanks, I don’t know what happened, I just put your code and all are work!! thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.