I'm currently in the process of transitioning my code to Angular and I could use some assistance with creating a directive. Here's what I'm trying to convert:
jQuery(document).ready(function ($) {
"use strict";
$('#cool-navigation').append('<ul class="navigation">' + $('.navigation').html() + '</ul>');
});
to
app.directive('coolnavigation', function () {
return { template: '<ul class="navigation">' + $('.navigation').html() + '</ul>' };
});
These are the HTML views - one is the shell and the other is called topnav
<section data-cc-sizer data-ng-controller="shell as vm">
<!-- Sticky Nav -->
<div data-coolnavigation class="sticky-navigation" id="sticky-navigation"></div>
<!-- Sticky Nav -->
<div id="wrapper">
<div class="top_wrapper clearfix">
<header class="top-header shadow">
<div data-ng-include="'/app/layout/topnav.html'"></div>
</header>
</div>
</div>
<section id="content">
<div id="wrapper" data-ng-view></div>
</section>
</section>
<section data-cc-topnav data-ng-controller="topnav as vm">
<div class="container">
<div class="row header">
<div class="col-class">
<nav>
<ul class="navigation">
<li data-ng-repeat="r in vm.navRoutes">
<a href="#{{r.url}}" class="{{r.className}}" data-ng-bind-html="r.config.settings.content"></a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</section>
I feel like there might be an issue with the .html(). Can someone help me figure this out?
Thank you!