AngularJS - filter for undefined properties in ng-repeat?

前端 未结 4 951
天涯浪人
天涯浪人 2021-02-05 00:43

For my AngularJS project (v1.2.3), I have a list of routes and am trying to build a navigation bar from the object. What I want to do is display any object with an undefined

4条回答
  •  名媛妹妹
    2021-02-05 01:00

    You can also use

  • see also How to display placeholders in AngularJS for undefined expression values?

    var app = angular.module('myApp', [])
    
    app.controller('mainCtrl',['$scope' , function($scope) {
    
    
    $scope.nav = [
        { path: '/', title: 'Home' },
        { path: '/blog', title: 'Blog' },
        { path: '/about', title: 'About' },
        { path: '/login', title: 'Login', isRight: true }
    ];
      
    }])

    !isRight

    • {{link.title}}

    isRight

    • {{link.title}}

提交回复
热议问题