last day (14 days later) » 

11:25 AM
0
Q: add a row to a tabale using angularjs

Chawqi Hajar Here's my form <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> ...

 
$scope.bds.push(bd) from where are you passing parameter "bd' in this?
 
You forgot to name your var (probably "bd") at the start of addRow
 
i add var bd={...}; it doesn't work :/
 
Have you got any error in the console ? Could you reproduce the bug in a fiddle or a plunker ?
 
Reena , i declare the model with ng-model="bd" , me too i can not understand how it will pass the parameter "bd" i am new to angularjs and i just follow some instructions in tutoriels .if you could help me i will be very grateful
 
11:25 AM
Is your function addRow being called? try to add alert and see if it's being called
 
No ,it's not called
 
R u getting any console error?
 
No i don't run the application i just open the form with web browser to see if it works if i add a row (without running the application)
 
I think your controller is not being executed ,First of all your controller name is ExampleCtrl and your passing FormController (passed the controller name not the file name)
 
Rightclick + inspectElement. Then you can go in the "console" part. You'll see the javascript runtime console. You probably have an error in it.
@Reena Nice spot, could be this
 
11:25 AM
what is the error in Console ? in firefox use firebug to get the console error, in chrome rightclick inspectelement and then click on the console to see javascript errors
 
here's the error : Uncaught Error: [$injector:modulerr] Failed to instantiate module MyApp due to: Error: [$injector:nomod] Module 'MyApp' is not available! You either misspelled the module name or forgot to load it.
 
have you included MyApp in your HTML?
 
yes i include it here : <div class="dataTable_wrapper" ng-app="MyApp" ng-controller="formController">
 
have you declared it in this way angular.module('MyApp', [])? If yes where and how
 
yes in the controller like this way : angular.module('MyApp', []) .controller('formController', [ '$scope', function($scope) {.....
 
11:25 AM
Have a try at <body ng-app="MyApp"> and remove from div. Though it's not the solution but can just try and check if any console error
 
GET file:///C:/Users/Hajar/workspaceSpring/demoJpaT/src/main/resources/template…b-ad‌​‌​min-2-1.0.7/startbootstrap-sb-admin-2-1.0.7/pages/js/formController.js net::ERR_FILE_NOT_FOUND angular.js:63 Uncaught Error: [$injector:modulerr] Failed to instantiate module MyApp due to: Error: [$injector:nomod] Module 'MyApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
 
I guess your file(formController.js) path is not being recognized
 
what do you mean?
 
You have given the path js/formController.js, is it the wright path? As this file is not being recognized
 
i update the post to show use the structure of my project
 
11:39 AM
Did you see the structure?
 

last day (14 days later) »