Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* route menggunakan ui*/
- $stateProvider.state('member',{
- url : '/',
- templateUrl : '../js/templates/brand/home.html',
- controller: 'BrandCtrl'
- })
- /* controller */
- controller('BrandCtrl', function ($scope, ModalService, config, $ocLazyLoad, Brand, Auth, other) {
- /* page config */
- $scope.config = config.brand();
- $scope.isCollapsed = true;
- $scope.buttonOpacity = 1;
- $scope.alerts = [];
- $scope.closeAlert = function(index) {
- $scope.alerts.splice(index, 1);
- };
- /* brand modal */
- $scope.brandModal = function(){
- ModalService.trigger($scope.config.main + 'js/templates/brand/modal-brand-create.html','BrandCtrl');
- };
- /* brand submit */
- $scope.BrandSubmit = function(isValid){
- if (isValid) {
- Brand.save(Auth.getToken(),$scope.brandCreate).success(function(data) {
- /* Brand Data refresh*/
- $scope.brand.push(data.data);
- $scope.alerts.push({ type: 'success', msg: 'Your Brand is ready !' });
- $scope.brandCreate = {};
- })
- .error(function(data) {
- console.log(data);
- });
- }
- };
- })
- /* view */
- <h4 class="panel-title" style="font-size:25px" ng-show="!brand.length">
- No Brands, start create one !
- <hr>
- </h4>
- <table class="table" ng-show="brand.length">
- <tr ng-repeat="data in brand">
- <span class="label label-primary">{{ data.name }}</span>
- </tr>
- </table>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement