I'm not well experienced in angular js and your help desperately!
I'm trying to create a tab navigation for angular based website.
Here is my html:
<body ng-app = "app">
<div class="bottom-content-container">
<form class = "tab-nav">
<tab-nav nav = "popular"></tab-nav>
<tab-nav nav = "recent"></tab-nav>
</form>
<div class="tab-content" ng-switch = "tab">
<div ng-switch-when = "popular">
Popular Images
</div>
<div ng-switch-when = "recent">
Recent Images
</div>
</div>
</div>
</body>
And here is the js:
var app = angular.module('app', []);
app.directive('tabNav', function () {
return {
template : '<label> <input type="radio" ng-model="tab" value="{{nav}}" name = "tabnav" /><span>{{nav}}</span></label>',
replace:true,
scope:{
nav: '@'
}
};
});
The thing probably is that I'm messing up the scopes, and the directive is not changing the "tab" variable, so nothing happens.
Here is the jsbin
Thanks in advance!
value="{{nav}}"tovalue="{{tab}}"because you model is tab.