Create a <li class=“active”> around an active {{linkTo}}
问题 What is the cleanest way to get <li class="active"> for the active page in the following Ember app? index.html <script type="text/x-handlebars"> <ul class="nav"> <li>{{#linkTo 'ping'}}Ping{{/linkTo}}</li> <li>{{#linkTo 'pong'}}Pong{{/linkTo}}</li> </ul> </script> app.js App = Ember.Application.create() App.Router.map(function() { this.route("ping", { path: "/ping" }); this.route("pong", { path: "/pong" }); }); 回答1: replace in your template the li tags like so: index.html <script type="text/x