<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
<script src="jquery-1.9.1.min.js"></script>
</head>
<body>
<div ng-app="hd" ng-controller="ctrl">
设置:{{data}}
<br/>
获取:{{get.city}}
<br/><br/><br/><br/><br/>
<form method="post" action="">
商品:<input type="text" ng-model="goods.name"/><br/>
价格:<input type="text" ng-model="goods.price"/><br/>
<textarea name="goods"></textarea>
<input type="submit" />
</form>
</div>

<script>
var m=angular.module("hd",[]);
m.controller("ctrl",['$scope',function($scope){
$scope.data={'city':'xiamen'};
localStorage.setItem('data',angular.toJson($scope.data));//设置
$scope.get=angular.fromJson(localStorage.getItem('data'));//获取

$scope.goods={'name':'apple','price':10};
$('form').submit(function(){
$("[name='goods']").val(angular.toJson($scope.goods));//转化成字符串才会显示
return false;
});

}]);

</script>
</body>
</html>

angular笔记_7的更多相关文章

  1. angular笔记

    /** * Created by Administrator on 2016/5/3 0003. */ ng-app是告诉angularjs编译器把该元素当作编译的根 //定义模块 var myApp ...

  2. Angular笔记-select

    --select-- 设置默认选中值方法: <select ng-model="url" ng-options="x.url as x.site for x in ...

  3. angular笔记_6

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  4. angular笔记_5(全选/反选)

    全选和反选 BUG:当鼠标点击其中一个选项后,在点击全选按钮,该选项失效 <!DOCTYPE html><html lang="en"><head&g ...

  5. angular笔记_4(函数)

    angular.isString();是否字符串 angular.isNumber();是否数字 angular.isArray();是否数组 angular.isDate();是否日期/时间 ang ...

  6. angular笔记_3

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  7. angular笔记_2

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  8. angular笔记_1

    第一个angular文件<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js&q ...

  9. Angular 笔记系列(二)数据绑定

    数据绑定这块儿没啥说的,简单两个例子带过了. Hello World: <!DOCTYPE html> <html ng-app> <head> <title ...

随机推荐

  1. 用flask的扩展实现的简单的页面登录

    from flask import Flask,render_template,request,redirect,session app = Flask(__name__,template_folde ...

  2. python(5):scipy之numpy介绍

    python 的scipy 下面的三大库: numpy, matplotlib, pandas scipy 下面还有linalg 等 scipy 中的数据结构主要有三种: ndarray(n维数组), ...

  3. name

    问题 A: name 时间限制: 1 Sec  内存限制: 256 MB 题目描述 lpq同学最近突然对外国人的名字产生了兴趣,特别是外国女生的名字,于是他开始试图去认识一些国外的女生. 随着认识的女 ...

  4. mongoDB通过_id删除doc

    转载: 点击查看原文 做项目遇到一个需求,需要根据mongodb数据记录里面的_id字段删除相应的docs,实际使用时发现直接如下使用 db.collection('infochanges').rem ...

  5. Django将默认的SQLite更换为MySQL

    1.注释默认的SQLite3配置: blogproject/settings.py ''' DATABASES = { 'default': { 'ENGINE': 'django.db.backen ...

  6. IDM的Google商店插件

    官方扩展链接:https://chrome.google.com/webstore/detail/idm-integration-module/ngpampappnmepgilojfohadhhmbh ...

  7. 目标检测算法之R-CNN算法详解

    R-CNN全称为Region-CNN,它可以说是第一个成功地将深度学习应用到目标检测上的算法.后面提到的Fast R-CNN.Faster R-CNN全部都是建立在R-CNN的基础上的. 传统目标检测 ...

  8. 网站申请HTTPS 访问

    #生成证书和key openssl req -x509 -nodes -days 36500 -newkey rsa:2048 -keyout /opt/nginx/pdk.key -out /opt ...

  9. 爬取豆瓣电影TOP 250的电影存储到mongodb中

    爬取豆瓣电影TOP 250的电影存储到mongodb中 1.创建项目sp1 PS D:\scrapy> scrapy.exe startproject douban 2.创建一个爬虫 PS D: ...

  10. Leetcode 344. 反转字符串

    344. Reverse String 解题代码: class Solution { public: void reverseString(vector<char>& s) { , ...