JSFiddle - React, Tailwind, and code Playground
by Shaojiang Cai
HTML
<a href="#/main" class="bottom-nav-btn" ng-app="Joy" ng-controller="JoyCtrl">
<img ng-src="dist/images/toolbar1.png" alt="首页" class="nav-img" />
<p class="nav-text" ng-class="{active: isActive==='main'}">首页</p>
<p>{{ isActive === 'main' }}</p>
</a>
CSS
.active {
background: teal;
color: white;
}
JavaScript
angular.module('Joy', [])
.controller('JoyCtrl', ['$scope', function($scope) {
$scope.isActive = 'main';
}]);