角度花式网址
( )
做就是了
app . service ( 'myService' , function ( $http ) {
// GET http://api.example.com/users
return $http . get ( 'api://users' ) ;
} ) ;
不再
app . service ( 'myService' , function ( $http , apiUrl ) {
// GET http://api.example.com/users
return $http . get ( apiUrl + '/users' ) ;
} ) ;
灵活性——拦截器为赢!
可读性——没有额外的字符串连接或辅助调用
“可测试性”
用法
bower install angular-fancy-url --save
然后
angu
评论0
最新资源