Tuan-Anh Tran

Using AngularJS with jekyll

Posted on January 14, 2015  •  1 minutes  • 118 words

This blog is running on jekyll; and since I’m learning AngularJS, I want to try AngularJS on my blog as well. The problem is both are using double curly braces syntax, jekyll will consume it first when generating and AngularJS will be left with nothing.

In order to use AngularJS with jekyll, we have to instruct AngularJS to use different start and end symbol by using $interpolateProvider.

var myApp = angular.module('myApp', [], function($interpolateProvider) {
  $interpolateProvider.startSymbol('[[');
  $interpolateProvider.endSymbol(']]');
});

function MyCtrl($scope) {
  $scope.name = 'Clark Kent';
}

Using it with the new symbol

<div ng-controller="MyCtrl">
    Hello, [[name]]
</div>

That’s it. Enjoy hacking your blog.

P/S: I didn’t push any change to this blog. I’m just playing AngularJS and jekyll locally

Follow me

Here's where I hang out in social media