The nuclear modification factor R_{mathrm{AA}} and the azimuthal anisotropy coefficient v_{2} of prompt and nonprompt (i.e. those from decays of b hadrons) {mathrm{J}}/psi mesons, measured from PbPb and pp collisions at sqrt{{s_{_{text {NN}}}}} =2.76,mathrm{TeV} at the LHC, are reported. The results are presented in several event centrality intervals and several kinematic regions, for transverse momenta p_{mathrm{T}} >6.5,{mathrm{GeV}}/{mathrm{c}} and rapidity |{y}|<2.4, extending down to p_{mathrm{T}} =3,{mathrm{GeV}}/{mathrm{c}} in the 1.6<|{y}|<2.4 range. The v_{2} of prompt {mathrm{J}}/psi is found to be nonzero, but with no strong dependence on centrality, rapidity, or p_{mathrm{T}} over the full kinematic range studied. The measured v_{2} of nonprompt {mathrm{J}}/psi is consistent with zero. The R_{mathrm{AA}} of prompt {mathrm{J}}/psi exhibits a suppression that increases from peripheral to central collisions but does not vary strongly as a function of either y or p_{mathrm{T}} in the fiducial range. The nonprompt {mathrm{J}}/psi R_{mathrm{AA}} shows a suppression which becomes stronger as rapidity or p_{mathrm{T}} increases. The v_{2} and R_{mathrm{AA}} of open and hidden charm, and of open charm and beauty, are compared.