1.factory()快捷方式
m1.factory("myService",function(){ return{ name:"xiaoming", show:function(){ return this.name+"is a boy" } } })
2.service()面向对象创建方式
m1.service("myService",function(){ this.name="xiaoming", this.show:function(){ return this.name+"is a boy" } })
3.provider()供应商方式创建
m1.provider("myService",function(){ return{ $get:function(){ return function(num1,num2){ return Math.random()*(num2-num1)+num1 } } } })