angularjs - Angular.js with JsFiddle and dynamically changing a ng-controller value -
I try to write my first angular.js application and jQuery < / strong>.
There are many more calls in this, who have their own I am trying to change the value of the I am working on the remaining calls and the data has been displayed, so now I want to use the buttons which will be able to retrieve and display in the main DIV to select the following data. This value has changed in the So to get help, I tried to make a JSFDial, but I have made some fundamental errors because the buttons do not work, with a new set of values, Bella An alternative solution can be, but I can not find one. / code> Try this clear code, html script ng-controller .
NIG controller to output different vacancies in the DEV announcement.
ng-controller value, but it did not execute the new
ng-controller function.
ng-controller
angular JS
& lt; Div ng-app = 'myApp' & gt; & Lt; Div ng-controller = "controller" & gt; & Lt; Button ng-click = "click one ()" & gt; Rest1 calls a & lt; / Button & gt; & Lt; Button ng-click = "click two ()" & gt; Rest2 call two & lt; / Button & gt; & Lt; Hour & gt; & Lt; / Hour & gt; & Lt; Div style = "width: 50px; height: 50px;" Id = "MainDiv" & gt; & Lt; P & gt; {{EmptyData}} & lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;
var app = angular Module ('myApp', []); App.controller ('Controller', function ($ radius, $ http) {$ scope.clickRestOne = function () {$ http ({method: 'GET', url: 'your url',}). Error (function, data, position, header, config) {});} $ scope.clickRestTwo = (function, data, status, headers, config) {document.getElementById ("MainDiv"). Function () {$ Http ({method: 'GET', url: 'your url',}). Success (function (data, position, header, config) {document.getElementById ("mendiv"). InnerHTML = data; }). Error (function (data, position, header, config) {});}});
Comments
Post a Comment