thanks a lot ur code helped .....but why dis code was not working http://jsfiddle.net/wskta72o/...
On Friday, October 9, 2015 at 8:00:13 PM UTC+5:30, Sander Elias wrote: > > Hi Vendant, > > Try this in your plunker: > <!DOCTYPE html> > <html> > <head> > <link rel="stylesheet" href="style.css"> > <script src=" > https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.js" > ></script> > <script src=" > http://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular-animate.js" > ></script> > <script> > //My module is already created elsewhere > (function() { > 'use strict'; > angular > .module('csui', ['ngAnimate']) > .controller('PreviewController', preview); > > function preview($http) { > var vm = this; > > $http.get("https://api.myjson.com/bins/30e2a") > .then(function(response) { > var data = response.data; > //Dummy data taken from JSON file > vm.firstName = data.firstName; > vm.lastName = data.lastName; > }); > > //Functions have been defined. Functionality to be added. > vm.addDataSet = function() { > alert("Function not defined"); > }; > } > }()); > </script> > </head> > <body ng-app='csui'> > <div ng-controller="PreviewController as prevCtrl"> > First Name: {{prevCtrl.firstName}}<br> > Last Name: {{prevCtrl.lastName}}<br> > <button ng-click="prevCtrl.addDataSet()">Add</button> > </div> > </body> > </html> > > > Regards > Sander > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
