It's there, though I wonder if the syntax might be incorrect...I've  been 
tinkering since my post, so I've posted the most current code below - in 
the HTML I set the app and module here:

<div ng-cloak>
  <head ng-app="trmApp"></head>
  <h1>Robot Keyword Libraries</h1>
  <md-tabs md-dynamic-height md-border-bottom>
    <md-tab label="Keyword Documentation">
      <md-content class="md-padding">
        <div ng-controller="getKwDocs">
          <button id="Get Keywords" ng-click="loadKwData()">Get 
Keywords</button>
          <div ng-repeat="data in kwData">
            <h3> {{ data }} </h3>
          </div>
        </div>
      </md-content>
    </md-tab>
  </md-tabs>
</div>

Then in the js, I set the app and controller like this:

angular.module('trmApp').angular.controller('getKwDocs', function($scope, 
$http) {

// load the keywords
$scope.loadKwData = function() {
console.log('loadKwData function called')
$http.get('/trm/kw_test').success(
function(response) {
$scope.kwData = response.data;
})
.error(console.error('Failed'))
};
});


On Wednesday, April 19, 2017 at 11:40:41 PM UTC-4, Andy Barrionuevo wrote:
>
> I assume you declared ng-app="APP  NAME" some where at the top of your 
> html?
> And added angular.module('APP NAME', ['DEPENDENCIES, if any]') at the top 
> of your js file?
>
> On Wednesday, April 19, 2017 at 9:36:30 PM UTC-5, jimmyja...@gmail.com 
> wrote:
>>
>> Hi, I'm brand new to the group, and brand new to angular js...I've been 
>> tasked with coding something kind of outside my wheelhouse and I'm hoping 
>> someone out there might be able to throw me a rope. To start, I'm trying to 
>> create a simple html page that uses a single, simple angularjs controller 
>> to issue a REST call to a running application. Currently when I run it, the 
>> page loads, and it displays the header and the button, but when I click on 
>> it nothing happens.  The variable of 'data' ends up getting printed out 
>> literally as '{{ data }}', though I suspect this may be because the 
>> controlled function is never getting called - I can see from inside the 
>> REST interface that it is never receiving any request, so I think I've got 
>> something fundamentally wrong here. Can anyone steer me in the right 
>> direction? Thanks!
>>
>> Here is the html page:
>>
>> *<div ng-cloak>*
>> *  <h1>Keyword Libraries</h1>*
>> *  <md-tabs md-dynamic-height md-border-bottom>*
>> *    <md-tab label="Keyword Documentation">*
>> *      <md-content class="md-padding">*
>> *        <div ng-controller="getKwDocs" ng-init="loadKwData()">*
>> *          <button id="Get Keywords" ng-click="loadKwData()">Get 
>> Keywords</button>*
>> *          <div ng-repeat="data in kwData">*
>> *            <h3> {{ data }} </h3>*
>> *          </div>*
>> *        </div>*
>> *      </md-content>*
>> *    </md-tab>*
>> *  </md-tabs>*
>> *</div>*
>>
>> And the controller looks like this:
>>
>> *angular.controller('getKwDocs', function($scope, $http) {*
>>
>> * // load the keywords*
>> * $scope.loadKwData = function() {*
>> * $http.get('/trm/kw_test').success(*
>> * function(data) {*
>> * $scope.kwData = data;*
>> * });*
>> * };*
>> *});*
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to