AngularJS视图模型序列化 [英] AngularJS ViewModel Serialization

查看:118
本文介绍了AngularJS视图模型序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何序列化AngularJS视图模型($范围)?我打算来存储序列化的值到ASP.NET服务器端格在回传,以继续存在。

How to serialize the ViewModel ($scope) in AngularJS? I'm planning to store the serialized value to a ASP.NET server-side div to persists across postbacks.

推荐答案

$范围是AngularJS创建与标记进行交互的对象。它可以包含可从HTML引用的方法。您可以为存储和传输数据,并保持它在你的范围内创建一个简单的JavaScript对象。

$scope is an object created by AngularJS to interact with the markup. It can contain methods that can be referenced from html. You can create a simple JavaScript object for storing and transferring data and keep it in your scope.

$scope.model = { name : 'my model' };

这篇关于AngularJS视图模型序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆