Home | Twitter | LinkedIn | Consulting | About | RSS | Map Areas: Projects:
Thu, 28 Apr 2016
It is possible to use Angular to easily disable controls depending on certain conditions. A simple example follows.
HTML File |
Lines 1-10 - Standard stuff (see previous examples)
Line 11 - Set a checkbox to be the model
Fri, 22 Apr 2016
Better Controller Example
Line 6 - Same as previous example
Line 7 - We'll call our controller 'recordViewer'
Line 8 - Default a recordIndex property in the scope to zero
Lines 11-13 - Define a nextRecord function that increments the index and checks if that number is greater than 2. If so, revert the recordIndex back to zero.
Lines 15-16 - As in the previous example, except this time we set the currentRecord to an object that contains values from our data bank.
Line 11 - Here we reference the recordViewer controller
Line 20 - The ng-click fires the nextRecord() routine. Every time the button is called the currentRecord changes, which is reflected on the screen.
Tue, 12 Apr 2016
As an MVC framework you would expect the controllers to be separated from the view and the model. One would think that a model would be restricted to some persistent storage somewhere but this framework (at least these examples that I appropriated) points to fields.
Lines 2-6 - This was commented out. An example from a book claimed this would work but I simply got errors.
Line 9 - Define app
Line 10 - Use this app to define the controller
Lines 11, 12 - Specify values
Line 6 - Load angular
Line 7 - Load the (above) controller file
Line 11 - Specify both the app and the controller. Other examples have this on multiple lines using different tags.
Line 14 - Here is the first model mapping.
Line 16 - Here is another.
Line 17 - In this case ng-bind is easier to use.
Line 19 - Use first and last from $scope.
Loading angular and having it
© 2015-2017. All Rights Reserved. All original code appearing on this site is MIT Licensed unless otherwise noted.