javascript - AngularJS - ng-show not working as intended -
i'm trying hide <a>
tags, , show them when i'm logged in, using isloggedin()
function, <a>
tag showing no matter what.
html (pool-details.html)
<header class="hero-unit" id="banner" ng-include="'components/header/header.html'"></header> <div ng-include="'components/navbar/navbar.html'"></div> <div class="container"> <hr> <div class="col-md-3 left-col-3"> <div ng-include="'../components/sidebar/sidebar.html'"></div> </div> <div class="col-md-5"> <div class="details-pic"> <img class="pool-details-pic" ng-src="{{ pool.picture }}"/> </div> </div> <div class="col-md-4"> <h3 class="details-name">{{ pool.name }}</h3> <p class="details-info">varenummer: {{ pool.number }}</p> <p class="details-info">lager status: {{ pool.instock }}</p> <p class="details-info">dimensioner: {{ pool.width }}m x {{ pool.length }}m x {{ pool.height }}m</p> <hr> <p class="details-info">{{ pool.info }}</p> </div> <div class="col-md-12"> <a ng-show="'isloggedin()'" ng-click="deleteproduct(pool)" class="delete-product">slet</a> <a ng-show="'isloggedin()'" ng-click="editproduct(pool)" class="edit-product">opdater</a> </div> </div> <footer class="footer" ng-include="'components/footer/footer.html'"></footer>
controller (pool-details.controller.js)
'use strict'; angular.module('welldanajavascriptapp') .controller('pooldetailsctrl', function ($scope, $stateparams, $state, poolservice, auth) { $scope.pool = {}; poolservice.find($stateparams.poolid, function(pool) { $scope.pool = pool; }); $scope.deleteproduct = function(product){ poolservice.delete(product._id, function(){ $state.go('pools'); }); }; });
i can't wrap head around why <a>
tag still showing, though i'm not logged in. i'm using passport plugin angular fullstack application.
ng-show="'isloggedin()'"
it calculates 'isloggedin()' string , true, should refactor asng-show="isloggedin()"
Comments
Post a Comment