vlad пре 6 година
родитељ
комит
9c5d67e0de
6 измењених фајлова са 17 додато и 3 уклоњено
  1. 3 0
      app/app.config.js
  2. 1 0
      app/app.module.js
  3. 6 0
      app/controllers/authors.controller.js
  4. 5 2
      app/views/authors.template.html
  5. 1 0
      index.html
  6. 1 1
      package.json

+ 3 - 0
app/app.config.js

@@ -4,6 +4,9 @@ app.run(function($rootScope, $location) {
 	});
 
 });
+app.run(['editableOptions', function(editableOptions) {
+	editableOptions.theme = 'bs3'; // bootstrap3 theme. Can be also 'bs2', 'default'
+}]);
 app.config(['$translateProvider', function($translateProvider) {
 	// var translations = {
 	// 	en: {

+ 1 - 0
app/app.module.js

@@ -2,5 +2,6 @@ window.app = angular.module('fea5', [
 	'ngRoute',
 	'ui.bootstrap',
 	'cgNotify',
+	'xeditable',
 	'pascalprecht.translate'
 	]);

+ 6 - 0
app/controllers/authors.controller.js

@@ -16,6 +16,12 @@
         //     message: 'her na lob',
         //     type: 'danger'
         // })
+        $scope.user = {
+            name: 'awesome user'
+        };
+        $scope.updateUser = function(){
+            console.log($scope.user)
+        };
         
     }])
 })();

+ 5 - 2
app/views/authors.template.html

@@ -1,4 +1,7 @@
 <h2 class="page-header">Athors</h2>
+
+<a href="#" editable-text="user.name" onaftersave='updateUser()'>{{ user.name || "empty" }}</a>
+
 <table class="table table-hover">
     <thead>
         <th>Firstname</th>
@@ -10,7 +13,7 @@
         <th class="float-right">
             <button  class="btn-danger btn-xs pull-right" ng-click="deteteAuthor(author)"><i class="glyphicon glyphicon-trash"></i></button>
             <button  class="btn-warning btn-xs pull-right"><i class="glyphicon glyphicon-pencil"></i></button>
-            
+ 
         </th>
     </tbody>
-</table>
+</table>

+ 1 - 0
index.html

@@ -7,6 +7,7 @@
   <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css" />
 	<link rel="stylesheet" href="css/style.css">
 	<link rel="stylesheet" href="./app/directive/lang-swicher/lang-swicher.css">
+	<link rel="stylesheet" href="./node_modules/angular-xeditable/dist/css/xeditable.min.css">
 </head>
 	<body ng-controller="Main">
 	  <div class="container">	  

+ 1 - 1
package.json

@@ -20,8 +20,8 @@
     "style-loader": "^0.21.0"
   },
   "bundleDependencies": [
-    "@cgross/angular-notify",
     "angular",
+    "@cgross/angular-notify",
     "angular-route",
     "angular-translate",
     "angular-translate-loader-static-files",