Created
December 15, 2014 14:34
-
-
Save nightbear1009/91988b926782f390c091 to your computer and use it in GitHub Desktop.
angularJs - two way binding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" ng-app> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>AngualrJs</title> | |
</head> | |
<body> | |
<input type="number" class="form-control" id="productPrice" placeholder="價格" | |
ng-model="newProduct.price"> | |
</input> | |
<label > {{ newProduct.price}}</label> | |
<script src="../../node_modules/grunt-protractor-webdriver/bower_components/angular/angular.js"></script> | |
<script> | |
angular.module('app', []); | |
/*** 請移除scope,更換為controllerAs ***/ | |
angular.module('app') | |
.controller('MainController', function ($scope) { | |
$scope.newProduct = { | |
name: '', | |
price: null | |
}; | |
}) | |
/*** end ***/ | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment