On Tuesday, December 23, 2014 5:20:12 PM UTC-6, Michael Powell wrote:
>
> Hello,
>
> I've been up and down through the docs, and yes, I am becoming familiar
> with tutorial examples, which I understand may be oversimplified. I cannot
> seem to make this work, the rendering falls over as soon as I add the
> ng-controller directive, which tells me that perhaps I haven't bundled
> something correctly (?), or I need another angular reference, or something.
>
Got it sorted out. It was a problem in the ASP MVC layout. The Angular JS
needed to be included prior to the RenderBody.
I am working from a more than less vanilla ASP.NET MVC 5 app. I've got a
> bare bones HomeController with basically empty Index. Nothing magical about
> this. This is pretty much, that I can tell, boilerplate code from the
> online docs.
>
> Rendering in the curly braces was fine, model included, prior to
> introducing the ng-controller directive. But as soon as I add the
> directive, rendering breaks. I'm having a hard time seeing it.
>
> <script>
> var app = angular.module('app', []);
> app.controller("TweetController", [
> '$scope',
> function($scope) {
> $scope.result = [];
> $scope.firstName = "test";
> $scope.doSearch = function(name) {
> $scope.result = ["bob", "mike", name];
> };
> }
> ]);
> </script>
>
> <div ng-controller="TweetController">
> <!-- expressions are perfectly fine -->
> {{ "hello world" }}
> <input type="text" ng-model="firstName" />
> <button ng-click="doSearch(firstName)">Go</button>
> {{ result }}
> </div>
>
>
> Can someone help?
>
> Thank you...
>
>
--
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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.