Last active
August 23, 2016 04:59
-
-
Save yoren/99f2f2f8887eeb75eeb2 to your computer and use it in GitHub Desktop.
Making WordPress Admin Bar Work With AngularJS Theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<base href="/jsonapi/"> | |
<title>AngularJS Demo Theme</title> | |
<?php wp_head(); ?> | |
</head> | |
<body> | |
<div id="page" ng-app="app"> | |
<header> | |
<h1> | |
<a href="<?php echo site_url(); ?>">AngularJS Demo Theme</a> | |
</h1> | |
</header> | |
<div ng-view></div> | |
<footer> | |
© <?php echo date( 'Y' ); ?> | |
</footer> | |
</div> | |
<?php wp_footer(); ?> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<search-form></search-form> | |
<ul> | |
<li ng-repeat="post in posts"> | |
<a href="blog/{{post.ID}}" ng-bind-html="post.title"></a> | |
<div ng-bind-html="post.content"></div> | |
</li> | |
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = angular.module('app', ['ngRoute', 'ngSanitize']); | |
//Config the route | |
app.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) { | |
$locationProvider.html5Mode(true); | |
$routeProvider | |
.when('/', { | |
templateUrl: myLocalized.partials + 'main.html', | |
controller: 'Main' | |
}) | |
.when('/blog/:ID', { | |
templateUrl: myLocalized.partials + 'content.html', | |
controller: 'Content' | |
}) | |
.otherwise({ | |
redirectTo: '/' | |
}); | |
}]); | |
//... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment