javascript - Dynamically adding angularjs directive with a $http to get -
javascript - Dynamically adding angularjs directive with a $http to get -
i stuck interesting problem,
i trying create soemthing of sort:
input key 1 , input value 1
input key 2 , input value 2 < button add together more >
< submit button >
basically user can click submit , issue request given url. when click add together more new row appears 2 input fields, can add together more http paarmeters.
i tried coding up, close this: http://jsfiddle.net/d2jl2n35/1/
could please help me...
two questions:
how dynamically add together new row after plus box clicked?
myapp.directive('options',function(){ homecoming { restrict:"e", template:"<div><input placeholder='params1' type='text'/><input placeholder='params2' type='text'><button><i class='glyphicon glyphicon-plus'></i></button></div>" }
})
ok solved first 1 using $compile: http://jsfiddle.net/kyer3/216/
how params , issue request?????
here rough example:
http://jsfiddle.net/d2jl2n35/9/
the crux of have store each set of values in array, , reuse directive show them. removed http phone call because didn't want sketch out echo service. if had real service this:
$http.get('/options').success( function( result ) { $scope.options = result; } );
javascript angularjs twitter-bootstrap-3 angularjs-directive angularjs-scope
Comments
Post a Comment