Reputation: 15303
I am doing a simple testing using angularjs
parse
method. I am not come with correct output from the testing what i do.
here is my code for angular:
var parseApp = angular.module('parse',[]);
parseApp.controller('parseController', ['$scope','$parse', function($scope,$parse){
$scope.parsedValue = "Testing";
$scope.$watch('expr',function(newVal,oldVal,scope){
if(newVal !== oldVal){
var parseFun = $parse(newVal);
$scope.parsedValue = parseFun(scope);
}
});
}])
the html is like this:
<div ng-app="parse">
<div ng-controller="parseController">
<input ng-model="expr"type="text" placeholder="Enter an expression" />
<h2>{{ parsedValue }}</h2>
</div>
</div>
getting error as:
Uncaught Error: [$injector:modulerr] Failed to instantiate module parse due to:
Error: [$injector:nomod] Module 'parse' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify th...<omitted>...0)
any one please figure-out me the wrong what i do here please?
Upvotes: 0
Views: 212