Skip to content

Instantly share code, notes, and snippets.

@adamweeks

adamweeks/revelaing.js Secret

Created May 18, 2015
Embed
What would you like to do?
Revealing Module Pattern for Angular Services
angular.module('blogpost.service',[])
.service('BlogpostService',BlogpostService);
function BlogpostSerivce(){
var service = this;
service.getBlogs = getBlogs;
service.createBlog = createBlog;
service.getBlogName = getBlogName;
//////////
var blogName = 'Test Blog';
var blogs = ['blog1', 'blog 2', 'blog3'];
function getBlogs(){
return blogs
}
function createBlog(blogObject){
blogs.push(blogObject);
}
function getBlogName(){
return blogName;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.