have this issue with Angular.js that I can't seem to fix.
Here is my simple html:
<html ng-app="myAngularapp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
<script src="myangular.js"></script>
</head>
<body>
<div ng-controller="myAngularCtrl">
<form ng-submit="addingName()">
<input type="text" ng-model="myAngular.newname" size="30"
placeholder="add new todo here">
<input class="btn-primary" type="submit" value="add">
</form>
</div>
</body>
</html>
and myangular.js:
angular.module("myAngularapp",[])
.controller("myAngularCtrl", function($scope){
$scope.myNames = [
{name:"aaa"},
{name:"aaa"},
{name:"aaa"}
];
$scope.addingName = function(){
$scope.myNames.push({name:newname});
}
});
When I press the submit button, I got an error:
Error: Can't find variable: newname
What seems to be the problem?