Skip to content
New issue

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

214 #5

Open
Wscats opened this issue Feb 14, 2017 · 0 comments
Open

214 #5

Wscats opened this issue Feb 14, 2017 · 0 comments

Comments

@Wscats
Copy link
Owner

Wscats commented Feb 14, 2017

数据从后端到前端

font-end <-data-ajax back-end

数据从前端到后端

font-end ajax-data-> back-end
$scope,$http,{{}} 从后端把数据渲染到前端

ng-model

ng-model可以用在input textarea select
ng-model 跟 {{}}它们两个都可以渲染值
ng-model多了一个接受输入值的功能
双向数据绑定,$scope.name改变,ng-model="name", {{name}}
ng-model改变,其他两个也会改变

ng-click

把函数作为数据,绑定到html结构里面
html

<button ng-click="jk()">JK</button>

js

$scope.jk = function() {
				console.log('提交数据')
				$http.get('test.php', {
					params: {
						name: $scope.input
					}
				}).success(function(data) {

				})
			}

表达式

表达式可以算数运算,字符串拼接

{{name+name}}

表达式也支持三元表达式,相当于if()else{}

{{name?'a':'b'}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant