angularjs - How to add categories and subcategories in meanjs -
i have 3 linked lists need work bit cascading drop-down lists, is, when select item in first list, second filter, filters third.
i need same this.[http://jsfiddle.net/benfosterdev/dwqhv/][1]
in example data added static, need add dynamic using module crud in meanjs.
categories controller:
angular.module('categories').controller('categoriescontroller', ['$scope', '$stateparams', '$location', 'authentication', 'categories', function($scope, $stateparams, $location, authentication, categories) { $scope.authentication = authentication; // create new category $scope.create = function() { // create new category object var category = new categories ({ name: this.name }); // redirect after save category.$save(function(response) { $location.path('categories/' + response._id); // clear form fields $scope.name = ''; }, function(errorresponse) { $scope.error = errorresponse.data.message; }); }; } ]);
create categories:
<section data-ng-controller="categoriescontroller"> <div class="page-header"> <h1>new category</h1> </div> <div class="col-md-12"> <form class="form-horizontal" data-ng-submit="create()" novalidate> <fieldset> <div class="form-group"> <label class="control-label" for="name">name</label> <div class="controls"> <input type="text" data-ng-model="name" id="name" class="form-control" placeholder="name" required> </div> </div> <div class="form-group"> <input type="submit" class="btn btn-default"> </div> <div data-ng-show="error" class="text-danger"> <strong data-ng-bind="error"></strong> </div> </fieldset> </form> </div>
Comments
Post a Comment