Your `alertHi` method is not defined as a property of $scope. The way ng-click works is, an expression (the value of the `ng-click` attribute) is evaluated within the context of the nearest $scope. Variables referenced in the expression need to exist in $scope or on its prototype chain.
Here’s a working example (only file changed is script.js): http://plnkr.co/edit/5HUTaGwhtnJLIcjleClw?p=preview <http://plnkr.co/edit/5HUTaGwhtnJLIcjleClw?p=preview> > On Mar 18, 2015, at 1:54 PM, Richard Hamilton > <richardgregoryhamil...@gmail.com> wrote: > > I am trying to learn angular, but am struggling with the ng-click function > > I am trying a simple example, where if I click a button, the user will be > alerted with a message. > > Here is my plunkr > > http://plnkr.co/edit/re40GAAB8NYFdrGBSTlk?p=preview > > I can't get it to work though. > > Where am I going wrong? > > -- > 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 angular+unsubscr...@googlegroups.com > <mailto:angular+unsubscr...@googlegroups.com>. > To post to this group, send email to angular@googlegroups.com > <mailto:angular@googlegroups.com>. > Visit this group at http://groups.google.com/group/angular > <http://groups.google.com/group/angular>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- 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 angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.