We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$cacheFactory可以用来进行数据在controller之间传递
var cache = $cacheFactory('wsscat'); 用**$cacheFactory**方法设置一个缓存,并赋给一个对象,该对象拥有下面的这些方法
var cache = $cacheFactory('wsscat');
用**$cacheFactory**在控制器之间交换数据要注意的是,如果刷新页面,数据就不复存在,所以在做单页面应用时候,如果想在不同视图不同控制器之间交换数据,这种方法慎用
其实**$cacheFactory**在控制器交换数据等同于自定义一个服务,然后在自定义服务中交换数据
app.controller('pageMain1Ctrl', function($scope, $cacheFactory) { var cache = $cacheFactory('wsscat'); cache.put('name', 'wsscat'); cache.put('age', 0); var info = cache.info(); console.log(info); }) app.controller('pageMain2Ctrl', function($scope, $state, $cacheFactory) { var cache = $cacheFactory.get('wsscat'); var name = cache.get('name'); console.log(name); })
The text was updated successfully, but these errors were encountered:
No branches or pull requests
$cacheFactory可以用来进行数据在controller之间传递
var cache = $cacheFactory('wsscat');
用**$cacheFactory**方法设置一个缓存,并赋给一个对象,该对象拥有下面的这些方法
用**$cacheFactory**在控制器之间交换数据要注意的是,如果刷新页面,数据就不复存在,所以在做单页面应用时候,如果想在不同视图不同控制器之间交换数据,这种方法慎用
其实**$cacheFactory**在控制器交换数据等同于自定义一个服务,然后在自定义服务中交换数据
The text was updated successfully, but these errors were encountered: